SHAppBarMessage Function--------------------------------------------------------------------------------Sends an appbar message to the system. SyntaxUINT_PTR SHAppBarMessage( DWORD dwMessage, PAPPBARDATA pData ); ParametersdwMessage Appbar message value to send. This parameter can be one of the following values: ABM_ACTIVATE Notifies the system that an appbar has been activated. ABM_GETAUTOHIDEBAR Retrieves the handle to the autohide appbar associated with a particular edge of the screen. ABM_GETSTATE Retrieves the autohide and always-on-top states of the Microsoft Windows taskbar. ABM_GETTASKBARPOS Retrieves the bounding rectangle of the Windows taskbar. ABM_NEW Registers a new appbar and specifies the message identifier that the system should use to send notification messages to the appbar. ABM_QUERYPOS Requests a size and screen position for an appbar. ABM_REMOVE Unregisters an appbar, removing the bar from the system's internal list. ABM_SETAUTOHIDEBAR Registers or unregisters an autohide appbar for an edge of the screen. ABM_SETPOS Sets the size and screen position of an appbar. ABM_SETSTATE Sets the state of the appbar's autohide and always-on-top attributes. ABM_WINDOWPOSCHANGED Notifies the system when an appbar's position has changed. pData Address of an APPBARDATA structure. The content of the structure depends on the value set in the dwMessage parameter. Return ValueReturns a message-dependent value. For more information, see the Microsoft Platform Software Development Kit (SDK) documentation for the appbar message sent.
Syntaxtypedef struct _AppBarData { DWORD cbSize; HWND hWnd; UINT uCallbackMessage; UINT uEdge; RECT rc; LPARAM lParam; } APPBARDATA, *PAPPBARDATA; MemberscbSize Contains the size of the structure, in bytes. hWnd Contains the handle to the appbar window. uCallbackMessage Application-defined message identifier. The application uses the specified identifier for notification messages that it sends to the appbar identified by the hWnd member. This member is used when sending the ABM_NEW message. uEdge Value that specifies an edge of the screen. This member is used when sending the ABM_GETAUTOHIDEBAR, ABM_QUERYPOS, ABM_SETAUTOHIDEBAR, and ABM_SETPOS messages. This member can be one of the following values:ABE_BOTTOM Bottom edge. ABE_LEFT Left edge. ABE_RIGHT Right edge. ABE_TOP Top edge. rc RECT structure to contain the bounding rectangle, in screen coordinates, of an appbar or the Microsoft Windows taskbar. This member is used when sending the ABM_GETTASKBARPOS, ABM_QUERYPOS, and ABM_SETPOS messages. lParam Message-dependent value. This member is used with the ABM_SETAUTOHIDEBAR and ABM_SETSTATE messages.
//是否自动隐藏
UINT uState = (UINT)::SHAppBarMessage(ABM_GETSTATE, &data);
if (uState == ABS_AUTOHIDE)
{
}
// 取得任务栏的位置信息
::SHAppBarMessage(ABM_GETTASKBARPOS, &data);
#include "shellapi.h"
::GetWindowRect(hShellWnd, &rc);
PAPPBARDATA pData
);
ParametersdwMessage
Appbar message value to send. This parameter can be one of the following values:
ABM_ACTIVATE
Notifies the system that an appbar has been activated.
ABM_GETAUTOHIDEBAR
Retrieves the handle to the autohide appbar associated with a particular edge of the screen.
ABM_GETSTATE
Retrieves the autohide and always-on-top states of the Microsoft Windows taskbar.
ABM_GETTASKBARPOS
Retrieves the bounding rectangle of the Windows taskbar.
ABM_NEW
Registers a new appbar and specifies the message identifier that the system should use to send notification messages to the appbar.
ABM_QUERYPOS
Requests a size and screen position for an appbar.
ABM_REMOVE
Unregisters an appbar, removing the bar from the system's internal list.
ABM_SETAUTOHIDEBAR
Registers or unregisters an autohide appbar for an edge of the screen.
ABM_SETPOS
Sets the size and screen position of an appbar.
ABM_SETSTATE
Sets the state of the appbar's autohide and always-on-top attributes.
ABM_WINDOWPOSCHANGED
Notifies the system when an appbar's position has changed.
pData
Address of an APPBARDATA structure. The content of the structure depends on the value set in the dwMessage parameter.
Return ValueReturns a message-dependent value. For more information, see the Microsoft Platform Software Development Kit (SDK) documentation for the appbar message sent.
DWORD cbSize;
HWND hWnd;
UINT uCallbackMessage;
UINT uEdge;
RECT rc;
LPARAM lParam;
} APPBARDATA, *PAPPBARDATA;
MemberscbSize
Contains the size of the structure, in bytes.
hWnd
Contains the handle to the appbar window.
uCallbackMessage
Application-defined message identifier. The application uses the specified identifier for notification messages that it sends to the appbar identified by the hWnd member. This member is used when sending the ABM_NEW message.
uEdge
Value that specifies an edge of the screen. This member is used when sending the ABM_GETAUTOHIDEBAR, ABM_QUERYPOS, ABM_SETAUTOHIDEBAR, and ABM_SETPOS messages. This member can be one of the following values:ABE_BOTTOM
Bottom edge.
ABE_LEFT
Left edge.
ABE_RIGHT
Right edge.
ABE_TOP
Top edge.
rc
RECT structure to contain the bounding rectangle, in screen coordinates, of an appbar or the Microsoft Windows taskbar. This member is used when sending the ABM_GETTASKBARPOS, ABM_QUERYPOS, and ABM_SETPOS messages.
lParam
Message-dependent value. This member is used with the ABM_SETAUTOHIDEBAR and ABM_SETSTATE messages.
FindWindow也可以做到,不过要麻烦一些。