Welcome! Log In Create A New Profile

Advanced

Taskbar

Posted by Carlo Hermus 
Carlo Hermus
Taskbar
March 17, 2008 07:55PM
Hi,

Anyone know how to calculate the height of the taskbar and where the taskbar is docked?
GuenterP
Re: Taskbar
March 17, 2008 10:13PM
Quote
Carlo Hermus
Hi,

Anyone know how to calculate the height of the taskbar and where the taskbar is docked?

Cheers,

Carlo

Hi Carlo,

I looked into this and found two approaches using API, have a look for yourself:
[www.codeguru.com]
[forums.devx.com]

I would go the easy way: First maximize a window for a short moment and find out position of the upper left corner and its dimensions, next resize and reposition it it to its original size & position. Now, the size of the maximized window is the size of the client area, its upper left corner ( x<>0 or y<>0 ) position tells you whether the task bar is docked left or on top of screen. Then use SysMetric( .. ) to find out the actual scren size pixel x pixel. Now it should be easy to tell whether the task bar is docked on bottom or right of the screen. Subtracting the Window size from the screen size reveals the size of the task bar.
Fabrice Harari
Re: Taskbar
March 17, 2008 10:56PM
Hi Everybody...

I didn't test, but I'm wondering what the result of this method will be on a system where the taskbar is autohiding?

Best regards

Fabrice
GuenterP
Re: Taskbar
March 17, 2008 11:47PM
Quote
Fabrice Harari
Hi Everybody...

I didn't test, but I'm wondering what the result of this method will be on a system where the taskbar is autohiding?

Best regards

Fabrice

Hi Fabrice, yes, that's a drawback, because if you're starting an application while TaskBarAutoHideON = True you would get windowsize = size of client area, thus one couldn't locate the docking position of the task bar. However, I do not see the purpose of Carlo's question in the first place ... why would he want to know the size of the task bar?Maybe, he could shed some light on it.
Carlo Hermus
Re: Taskbar
March 18, 2008 12:05AM
Guenter and Fabrice,

Well I am not great with API, but I try. I have a little bit problems to address the rect structure.

Why do I need the height? Because I want to create a popup screen (msn/outlook style) on top of the taskbar. I now am creating one in the center (hor.) at the top of the screen pulling down, but I like one on top of the taskbar.

This is why I need the height and I need the docked location.

BTW,

Any help on how to work with these would be apriciated.

FunctionResult is boolean // C Type:BOOL
hWnd is int // C Type:HWND
lpRect is int // Pointer on structureRECT

FunctionResult=API("USER32","GetWindowRect",hWnd,lpRect)


RECT is structure
left is int //Type C : LONG
top is int //Type C : LONG
right is int //Type C : LONG
bottom is int //Type C : LONG
END
Paulo Oliveira
Re: Taskbar
March 19, 2008 02:07PM
Have you tried SYSICON* instructions ?
Carlo Hermus
Re: Taskbar
March 20, 2008 07:01PM
Paulo,

Could you please explain?

I looked at the sysicon features but cannot find where the functions are for the height of the taskbar and where it is docked.

Regards,
Carlo
Peter van Vuuren
Re: Taskbar
March 21, 2008 10:19AM
Hi,

Api to get height (...) of taskbar

Init
RECT is structure
	nLeft is int
	nTop is int
	nRight is int
	nBottom is int	
END

APPBARDATA is structure
	nCbSize is int
	nHwnd is int
	nUCallbackMessage is int
	nUEdge is int
	APBRECT is RECT
	nLParam is int			
END

ABM_GETTASKBARPOS is int = 0x5//&H5

Get height taskbar

ABD is APPBARDATA
API("SHELL32.DLL","SHAppBarMessage",ABM_GETTASKBARPOS,&ABD)

//Trace("right "+abd:APBRECT:nRight)
//Trace("left "+ABD:APBRECT:nleft)
//Trace("top "+ABD:APBRECT:ntop)
//Trace("bottom "+ABD:APBRECT:nBottom)
Trace("height "+(ABD:APBRECT:nBottom-ABD:APBRECT:nTop))

Carlo Hermus
Re: Taskbar
March 21, 2008 02:38PM
Thanks this is working great, with left,right,top,bottom I can als see where it is docked. Just follow the zero's winking smiley.

Now I am playing with the autohide settings.

Thank you very much.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: