Application Desktop Toolbars 桌面工具栏(1)
An application desktop toolbar (also called an appbar) is a window that is similar to the Microsoft Windows taskbar. It is anchored to an edge of the screen, and it typically contains buttons that give the user quick access to other applications and windows. The system prevents other applications from using the desktop area occupied by an appbar. Any number of appbars can exist on the desktop at any given time.
桌面工具栏(也称作appbar)是类似微软视窗系统的任务条的窗口。它紧靠屏幕边缘,典型的桌面工具栏包括快速访问其他应用程序和窗口的按钮。系统会防止其他应用程序使用被appbar占用的区域。在任何时刻桌面都可以同时共存多个appbar。
About Application Desktop Toolbars
桌面工具栏简介
Windows provides an application programming interface (API) that lets you take advantage of appbar services provided by the system. The services help ensure that application-defined appbars operate smoothly with one another and with the taskbar. The system maintains information about each appbar and sends the appbars messages to notify them about events that can affect their size, position, and appearance.
微软视窗提供了一个应用编程接口(API)以方便你利用appbar service的特长。这些服务可以确保应用程序定义的appbar和其他appbar或任务栏之间进行协调工作。系统会维护每一个taskbar的信息,并且在有影响taskbar尺寸、位置和外观等事件发生时,系统会通知他们。
Sending Messages
发送消息
An application uses a special set of messages, called appbar messages, to add or remove an appbar, set an appbar's size and position, and retrieve information about the size, position, and state of the taskbar. To send an appbar message, an application must use the SHAppBarMessage function. The function's parameters include a message identifier, such as ABM_NEW, and the address of an APPBARDATA structure. The structure members contain information that the system needs to process the given message.
应用程序使用一组特殊称作appbar messages的消息集合,利用这些消息,可以增加、删除appbar应用,设置appbar的尺寸、位置,接收有关appbar的尺寸、位置消息以及任务栏的状态信息。应用程序使用SHAppBarMessage函数发送appbar message,这个函数包含两个参数,一个是消息标识符(如:ABM_NEW),另一个是结构体APPBARDATA的地址。结
构体参数包括系统需要处理的消息的信息。
For any given appbar message, the system uses some members of the APPBARDATA structure and ignores the others. However, the system always uses the cbSize and hWnd members, so an application must fill these members for every appbar message. The cbSize member specifies the size of the structure, and the hWnd member is the handle to the appbar's window.
对任何给定的appbar message,系统只是采用结构体APPBARDATA的部分参数而忽略其他参数,但是cbSize和hWnd这两个参数总是要使用的,因此应用程序要为每个appbar message填充这两个参数。CbSize参数指明结构体的大小,hWnd代表appbar的窗口句柄。
Some appbar messages request information from the system. When processing these messages, the system copies the requested information into the APPBARDATA structure.
有一些appbar message可以从系统获取信息,在处理这些消息的时候,系统会将需要的信息拷贝到结构体APPBARDATA中去。
Application Desktop Toolbars 桌面工具栏(2)
注释:
SHAppBarMessage
WINSHELLAPI UINT APIENTRY SHAppBarMessage(
DWORD dwMessage,
PAPPBARDATA pData
);
Sends an appbar message to the system.
向系统发送appbar message。
l Returns a message-dependent value. For more information, see the Microsoft Platform SDK documentation for the appbar message sent.
返回值由消息决定,不同的消息返回不同的值。如果需要了解更多的信息,可以参看Microsoft Platform SDK文档的appbar message sent部分。
dwMessage
参数一: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.
激活一个appbar。
ABM_GETAUTOHIDEBAR Retrieves the handle to the autohide appbar associated with
a particular edge of the screen.
获得和屏幕边缘关联的一个自动隐藏appbar的句柄。
ABM_GETSTATE Retrieves the autohide and always-on-top states of the
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.
注册一个appbar并指定消息标识符(给appbar发送通知用)。
ABM_QUERYPOS Requests a size and screen position for an appbar.
取得appbar的尺寸和appbar在屏幕中的位置。
ABM_REMOVE Unregisters an appbar, removing the bar from the system's
internal list.
注销appbar并从系统内部列表中移除该appbar。
ABM_SETAUTOHIDEBAR Registers or unregisters an autohide appbar for an edge of
the screen.
给屏幕的一个边缘注册/注销一个自动隐藏的appbar。
ABM_SETPOS Sets the size and screen position of an appbar.
设置appbar的尺寸和appbar在屏幕中的位置。
ABM_WINDOWPOSCHANGED Notifies the system when an appbar's position has
changed.
通知系统一个appbar的位置已经改变。
pData
参数二:pData
Address of an APPBARDATA structure. The content of the structure depends on the value set in the dwMessage parameter.
结构体APPBARDATA的地址。结构体的内容依赖于dwMessage参数的设置。
Application Desktop Toolbars 桌面工具栏(3)
APPBARDATA
typedef struct _AppBarData {
DWORD cbSize;
HWND hWnd;
UINT uCallbackMessage;
UINT uEdge;
RECT rc;
LPARAM lParam;
} APPBARDATA, *PAPPBARDATA;
Contains information about a system appbar message. This structure is used with the SHAppBarMessage function.
appbar message所包含的信息。这个结构体供函数SHAppBarMessage使用。
cbSize: Contains the size of the structure, in bytes.
以字节形式表示结构体大小。
hWnd: Contains the handle to the appbar window.
appbar 窗口句柄。
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.
应用程序定义的消息标识符。应用程序使用该标志符发送通知消
息到由hWnd指定的appbar。
uEdge: Value that specifies an edge of the screen. 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.
This member is used when sending the ABM_GETAUTOHIDEBAR,
ABM_QUERYPOS, ABM_SETAUTOHIDEBAR, and ABM_SETPOS
messages.
该参数只有在发送ABM_GETAUTOHIDEBAR、ABM_QUERYPOS、
ABM_SETAUTOHIDEBAR和ABM_SETPOS消息时使用。
rc: RECT structure to contain the bounding rectangle, in screen
coordinates, of an appbar or the Windows taskbar. This
member is used when sending the ABM_GETTASKBARPOS,
ABM_QUERYPOS, and ABM_SETPOS messages.
结构体RECT指定appbar或视窗任务栏的区域。该参数只有在发
送ABM_GETTASKBARPOS、ABM_QUERYPOS、ABM_SETPOS时使用。
lParam: Message-dependent value. This member is used with the
ABM_SETAUTOHIDEBAR message.
一个依赖于消息的值。该参数只有在发送ABM_SETAUTOHIDEBAR
时使用。
An application desktop toolbar (also called an appbar) is a window that is similar to the Microsoft Windows taskbar. It is anchored to an edge of the screen, and it typically contains buttons that give the user quick access to other applications and windows. The system prevents other applications from using the desktop area occupied by an appbar. Any number of appbars can exist on the desktop at any given time.
桌面工具栏(也称作appbar)是类似微软视窗系统的任务条的窗口。它紧靠屏幕边缘,典型的桌面工具栏包括快速访问其他应用程序和窗口的按钮。系统会防止其他应用程序使用被appbar占用的区域。在任何时刻桌面都可以同时共存多个appbar。
About Application Desktop Toolbars
桌面工具栏简介
Windows provides an application programming interface (API) that lets you take advantage of appbar services provided by the system. The services help ensure that application-defined appbars operate smoothly with one another and with the taskbar. The system maintains information about each appbar and sends the appbars messages to notify them about events that can affect their size, position, and appearance.
微软视窗提供了一个应用编程接口(API)以方便你利用appbar service的特长。这些服务可以确保应用程序定义的appbar和其他appbar或任务栏之间进行协调工作。系统会维护每一个taskbar的信息,并且在有影响taskbar尺寸、位置和外观等事件发生时,系统会通知他们。
Sending Messages
发送消息
An application uses a special set of messages, called appbar messages, to add or remove an appbar, set an appbar's size and position, and retrieve information about the size, position, and state of the taskbar. To send an appbar message, an application must use the SHAppBarMessage function. The function's parameters include a message identifier, such as ABM_NEW, and the address of an APPBARDATA structure. The structure members contain information that the system needs to process the given message.
应用程序使用一组特殊称作appbar messages的消息集合,利用这些消息,可以增加、删除appbar应用,设置appbar的尺寸、位置,接收有关appbar的尺寸、位置消息以及任务栏的状态信息。应用程序使用SHAppBarMessage函数发送appbar message,这个函数包含两个参数,一个是消息标识符(如:ABM_NEW),另一个是结构体APPBARDATA的地址。结
构体参数包括系统需要处理的消息的信息。
For any given appbar message, the system uses some members of the APPBARDATA structure and ignores the others. However, the system always uses the cbSize and hWnd members, so an application must fill these members for every appbar message. The cbSize member specifies the size of the structure, and the hWnd member is the handle to the appbar's window.
对任何给定的appbar message,系统只是采用结构体APPBARDATA的部分参数而忽略其他参数,但是cbSize和hWnd这两个参数总是要使用的,因此应用程序要为每个appbar message填充这两个参数。CbSize参数指明结构体的大小,hWnd代表appbar的窗口句柄。
Some appbar messages request information from the system. When processing these messages, the system copies the requested information into the APPBARDATA structure.
有一些appbar message可以从系统获取信息,在处理这些消息的时候,系统会将需要的信息拷贝到结构体APPBARDATA中去。
Application Desktop Toolbars 桌面工具栏(2)
注释:
SHAppBarMessage
WINSHELLAPI UINT APIENTRY SHAppBarMessage(
DWORD dwMessage,
PAPPBARDATA pData
);
Sends an appbar message to the system.
向系统发送appbar message。
l Returns a message-dependent value. For more information, see the Microsoft Platform SDK documentation for the appbar message sent.
返回值由消息决定,不同的消息返回不同的值。如果需要了解更多的信息,可以参看Microsoft Platform SDK文档的appbar message sent部分。
dwMessage
参数一: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.
激活一个appbar。
ABM_GETAUTOHIDEBAR Retrieves the handle to the autohide appbar associated with
a particular edge of the screen.
获得和屏幕边缘关联的一个自动隐藏appbar的句柄。
ABM_GETSTATE Retrieves the autohide and always-on-top states of the
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.
注册一个appbar并指定消息标识符(给appbar发送通知用)。
ABM_QUERYPOS Requests a size and screen position for an appbar.
取得appbar的尺寸和appbar在屏幕中的位置。
ABM_REMOVE Unregisters an appbar, removing the bar from the system's
internal list.
注销appbar并从系统内部列表中移除该appbar。
ABM_SETAUTOHIDEBAR Registers or unregisters an autohide appbar for an edge of
the screen.
给屏幕的一个边缘注册/注销一个自动隐藏的appbar。
ABM_SETPOS Sets the size and screen position of an appbar.
设置appbar的尺寸和appbar在屏幕中的位置。
ABM_WINDOWPOSCHANGED Notifies the system when an appbar's position has
changed.
通知系统一个appbar的位置已经改变。
pData
参数二:pData
Address of an APPBARDATA structure. The content of the structure depends on the value set in the dwMessage parameter.
结构体APPBARDATA的地址。结构体的内容依赖于dwMessage参数的设置。
Application Desktop Toolbars 桌面工具栏(3)
APPBARDATA
typedef struct _AppBarData {
DWORD cbSize;
HWND hWnd;
UINT uCallbackMessage;
UINT uEdge;
RECT rc;
LPARAM lParam;
} APPBARDATA, *PAPPBARDATA;
Contains information about a system appbar message. This structure is used with the SHAppBarMessage function.
appbar message所包含的信息。这个结构体供函数SHAppBarMessage使用。
cbSize: Contains the size of the structure, in bytes.
以字节形式表示结构体大小。
hWnd: Contains the handle to the appbar window.
appbar 窗口句柄。
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.
应用程序定义的消息标识符。应用程序使用该标志符发送通知消
息到由hWnd指定的appbar。
uEdge: Value that specifies an edge of the screen. 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.
This member is used when sending the ABM_GETAUTOHIDEBAR,
ABM_QUERYPOS, ABM_SETAUTOHIDEBAR, and ABM_SETPOS
messages.
该参数只有在发送ABM_GETAUTOHIDEBAR、ABM_QUERYPOS、
ABM_SETAUTOHIDEBAR和ABM_SETPOS消息时使用。
rc: RECT structure to contain the bounding rectangle, in screen
coordinates, of an appbar or the Windows taskbar. This
member is used when sending the ABM_GETTASKBARPOS,
ABM_QUERYPOS, and ABM_SETPOS messages.
结构体RECT指定appbar或视窗任务栏的区域。该参数只有在发
送ABM_GETTASKBARPOS、ABM_QUERYPOS、ABM_SETPOS时使用。
lParam: Message-dependent value. This member is used with the
ABM_SETAUTOHIDEBAR message.
一个依赖于消息的值。该参数只有在发送ABM_SETAUTOHIDEBAR
时使用。