手机站
网通分站
电信主站
密 码:
用户名:
当前位置 : 主页>程序设计>delphi>列表

How can I create a tray icon

来源:互联网 作者:西部数码 时间:2008-04-09
西部数码-全国虚拟主机10强!40余项虚拟主机管理功能,全国领先!双线多线虚拟主机南北访问畅通无阻!免费赠送企业邮局,.CN域名,自助建站480元起,免费试用7天,满意再付款! P4主机租用799元/月.月付免压金!
{*****************************************************
* How can I create a tray icon? *

Fortunately, creating an application that runs in the system tray is pretty easy -
only one (API) function, Shell_NotifyIcon, is needed to accomplish the task.
The function is defined in the ShellAPI unit and requires two parameters.

The first parameter (dwMessage) specifies the action to be taken.
This parameter can be one of the following values:

NIM_ADD: Adds an icon to the status area.
NIM_DELETE: Deletes an icon from the status area.
NIM_MODIFY: Modifies an icon in the status area.

* To display an icon in the system tray, call Shell_NotifyIcon with
the NIM_ADD flag.

* Any time you want to change the icon, tooltip text,
etc, you can call Shell_NotifyIcon with NIM_MODIFY.

* Before your program terminates, call Shell_NotifyIcon with NIM_DELETE
to clear your icon from the system tray.

The second parameter (pnid) is a pointer to a TNotifyIconData structure
holding the information about the icon.

The TNotifyIconData structure contains the following elements:

cbSize: Passes the size of the NOTIFYICONDATA data type.
Data Type: DWORD.

hWnd: Handle of the window used to receive the notification message.
Data Type: HWND.

uId: Identifier of the icon in the status area.
Data Type: UINT.

uFlags: Array of flags that indicate which of the other members contain
valid data.
Data Type: UINT.
Value: Any combination of the following constants to indicate that
the member of this structure is valid and will be used:

NIF_ICON: Passing this flag indicates that the value for the
hIcon will be the icon that appears in the taskbar status area.

NIF_MESSAGE: Passing this flag indicates that the uCallBackMessage
value will be used as the callback message.

NIF_TIP: Passing this flag indicates that the value of szTip will
be used as the ToolTip for the icon in the taskbar status area.

uCallBackMessage: Identifier of the notification message sent to the
window that is used to receive the messages.
Data Type: UINT.

hIcon: Handle of the icon that is displayed in the taskbar status area.
Data Type: HICON.

szTip: String to be used as the ToolTip text.
Data Type: Fixed-length AnsiChar 64 bytes long.

*****************************************************}

文章整理:西部数码--专业提供域名注册虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!