导航
  • 全部
...

任务栏位置的问题

tanyajun 2008-03-14 10:00:12
我怎么得到任务栏位置,高度等信息
...全文
给本帖投票
727 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
tanyajun 2008-03-14
  • 打赏
  • 举报
回复
可以,谢谢了,结贴了
  • 打赏
  • 举报
回复
试试WM_SETTINGCHANGE消息看.
tanyajun 2008-03-14
  • 打赏
  • 举报
回复
谢谢,懂了
还有个问题,我的程序怎么知道任务栏位置大小等改变了呢
cnzdgs 2008-03-14
  • 打赏
  • 举报
回复
用SHAppBarMessage函数。
FindWindow也可以做到,不过要麻烦一些。
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 zhoujianhei 的回复:]
C/C++ codeHWND hShellWnd=::FindWindow(_T("Shell_TrayWnd"), NULL);

CRect rc;
::GetWindowRect(hShellWnd,&rc);
[/Quote]
..................
  • 打赏
  • 举报
回复
Syntax

typedef struct _AppBarData {
DWORD cbSize;
HWND hWnd;
UINT uCallbackMessage;
UINT uEdge;
RECT rc;
LPARAM lParam;
} APPBARDATA, *PAPPBARDATA;
Members

cbSize
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.
  • 打赏
  • 举报
回复
SHAppBarMessage Function

--------------------------------------------------------------------------------

Sends an appbar message to the system.

Syntax

UINT_PTR SHAppBarMessage( DWORD dwMessage,
PAPPBARDATA pData
);
Parameters

dwMessage
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 Value

Returns a message-dependent value. For more information, see the Microsoft Platform Software Development Kit (SDK) documentation for the appbar message sent.

zhoujianhei 2008-03-14
  • 打赏
  • 举报
回复
	HWND hShellWnd = ::FindWindow(_T("Shell_TrayWnd"), NULL);

CRect rc;
::GetWindowRect(hShellWnd, &rc);
  • 打赏
  • 举报
回复
头文件
#include "shellapi.h"
  • 打赏
  • 举报
回复

//是否自动隐藏
UINT uState = (UINT)::SHAppBarMessage(ABM_GETSTATE, &data);
if (uState == ABS_AUTOHIDE)
{
}


// 取得任务栏的位置信息
::SHAppBarMessage(ABM_GETTASKBARPOS, &data);

15,980

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧

手机看
关注公众号

关注公众号

客服 返回
顶部