views:

695

answers:

4

How can I tell via a Delphi program if the Windows Explorer Taskbar is set to Autohide?

+12  A: 

In Windows XP and higher, you can call SHAppBarMessage API with ABM_GETSTATE message.

Syntax:

SHAppBarMessage(ABM_SETSTATE, pabd);

pabd is a pointer to APPBARDATA struct.
header file is: shellapi.h.

If you want to get state of taskbar, use ABM_GETSTATE message. you can call this api in delphi.

mSafdel
A: 

U have to deal with windows registry because this information is keept in there. Value indicating "autoohide" is written(read) only while user logon /logout ont with his account

Registry key responsible for storing this information is located in HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2 The only thing in there is settings and it is a 9th hex value for "autohide on" this value is 03 for "autohide off" it is 02

MoreThanChaos
That's a hack. One should ALWAYS use an API rather than access to undocumented registry info.
Serge - appTranslator
+10  A: 

What is is that you really want to find out? Is it because you want to know the area of the screen that is useable?

If so, then I believe you can use the Screen.WorkAreaRect to determine the available screen area, where all (permanent) tool bars etc. are excluded.

HeartWare
If the taskbar is in Autohide mode, then the space the taskbar uses will be included in the working area, even if the taskbar is currently in the visible position.
Zach Johnson
Yes - hence my "(permanent)" comment. When the task bar is in AutoHide mode, it is not a permanent task bar, and thus the screen space available includes the area that the task bar will cover when it appears.
HeartWare
+1  A: 

Use Win32 shell apis (IsTBAutohide and others)
See Google Groups for undocumented apis.
Never read registry (ans stop removing right answers, it's stupid...)