TaskBar size (OpenInsight 32-Bit)
At 16 MAY 2007 09:37:08PM Jim Vaughan wrote:
This is driving me crazy!
Why does the following code work OK when called with the debug statement in place and I step through the code; but fail (hTB is always zero) when called from within my code without the debug? I am running under Windows Vista.
Is Vista doing something?
Function [/color]TaskBarHeight([/color]Null[/color]) [/color] [/color]Declare Function [/color]FindWindow, Struct_To_Var, Blank_Struct [/color] [/color]debug [/color]hTB=FindWindow([/color]'Shell_TrayWnd'[/color], [/color]''[/color]); [/color]if [/color]hTB=[/color]0 [/color]then [/color]Result=[/color]0 [/color]End else [/color]TBRect=Blank_Struct( [/color]"RECT" [/color]) [/color]Call [/color]GetWindowRect(hTB, TBRect) TaskBarRect=Struct_To_Var(TBRect, [/color]"RECT"[/color]) Result=TaskBarRect4] [/color]- TaskBarRect2] [/color]End [/color] Return [/color]Result[/color][/color][/size]
At 17 MAY 2007 04:44AM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:
Jim,
How is FindWindow prototyped in your copy of OI? In mine it appears to be this (from DLL_USER32)
HANDLE STDCALL FindWindowA(LPCHAR,LPVOID) AS FINDWINDOWWhich means I would have to call it like so:
hTB=FindWindow( 'Shell_TrayWnd' : \00\, 0 );World leaders in all things RevSoft
Revelation Conference 2007, London - Wednesday 27th June Click here to register for the premier Revelation Software EMEA event of 2007
At 17 MAY 2007 01:49PM Jim Vaughan wrote:
Thank you, that did the trick.
For anyone that is interested the following code returns the height of the Windows task bar.
Function [/color]TaskBarHeight([/color]Null[/color]) [/color]******************************************************** * returns height of Windows task bar * ******************************************************** [/color]Declare Function [/color]FindWindow, Struct_To_Var, Blank_Struct [/color] hTB=FindWindow( [/color]'Shell_TrayWnd' [/color]: [/color]\00\[/color], [/color]0 [/color]); [/color]if [/color]hTB=[/color]0 [/color]then [/color]Result=[/color]0 [/color]End else [/color]TBRect=Blank_Struct( [/color]"RECT" [/color]) [/color]Call [/color]GetWindowRect(hTB, TBRect) TaskBarRect=Struct_To_Var(TBRect, [/color]"RECT"[/color]) Result=TaskBarRect4] [/color]- TaskBarRect2] [/color]End [/color] Return [/color]Result[/color][/color][/size]