Mega Code Archive

 
Categories / Delphi / Forms
 

How to get taskbar informations

Title: How to get taskbar informations Question: Determine on what side is the taskbar and if it's in autohiding mode. Answer: Here is a code I wrote some time ago that is useful to have taskbar information. Type vTaskBarInfo = ( tbpRight, tbpBottom, tbpTop, tbpLeft, tbpAutoHiding ); tTaskBarInfo = Set Of vTaskBarInfo; Function GetTaskBarInfo : tTaskBarInfo; Var hTaskbar : HWND; T : TRect; ScrW, ScrH : Integer; Function IsTaskbarAutoHideOn : Boolean; Var ABData : TAppBarData; Begin ABData.cbSize := SizeOf( ABData ); Result := ( SHAppBarMessage( ABM_GETSTATE, ABData ) And ABS_AUTOHIDE ) 0; End; Begin ScrW := Screen.Width; ScrH := Screen.Height; hTaskBar := FindWindow( 'Shell_TrayWnd', NIL ); GetWindowRect( hTaskBar, T ); Result := [tbpRight]; If ( ( T.Top ScrH Div 2 ) And ( T.Right = ScrW ) ) Then Result := [tbpBottom] Else If ( ( T.Top Result := [tbpTop] Else If ( ( T.left Result := [tbpLeft]; If ( IsTaskbarAutoHideOn ) Then Result := Result + [tbpAutoHiding]; End;