Shell_policyicon (System Tray Icon API function) details)

Source: Internet
Author: User
Tags time in milliseconds
Shell_policyicon is an API function used in Windows to generate the system tray icon.

I. Prototype

Bool shell_policyicon (
DWORD dwmessage,
Pnotifyicondata lpdata
);

The dephi statement is as follows:

Function shell_policyicon (dwmessage: DWORD; lpdata: ppolicyicondata): bool; stdcall;

Ii. Description of parameters and return values
1. dwmessage: [Input parameter] describes the action to be executed. The optional values of the action are as follows:
Nim_add add an icon to the tray Area
Nim_delete delete an icon from the tray Area
Nim_modify
Nim_setfocus returns the focus to the tray area. This message is usually sent after the tray icon completes the operation on the user interface. For example, if a tray icon shows a shortcut menu and the user presses the ESC key, nim_setfocus is used to keep the focus in the tray area. This item is only available in System Shell and common control DLL (shlwapi. dll and comctl32.dll) 5.0 or above.
Nim_setversion specifies the system shell and common control DLL of a specific version. The default value is 0, indicating that the Win95 method is used. This item is only available in the system shell and common control DLL 5.0 or later versions.
2. lpdata: [Input parameter] a pointer to the policyicondata structure.
The structure is described as follows:
 

Notifyicondata Structure
Typedef struct _ policyicondata {
DWORD cbsize;
Hwnd;
Uint uid;
Uint uflags;
Uint ucallbackmessage;
Hicon;
Tchar sztip [64];
DWORD dwstate;
DWORD dwstatemask;
Tchar szinfo [256];
Union {
Uint utimeout;
Uint uversion;
};
Tchar szinfotitle [64];
DWORD dwinfoflags;
Guid guiditem;
} Notifyicondata, * ppolicyicondata;

The cbsize is measured in bytes to adapt to different versions.
The window handle for hwnd to receive Windows messages.
ID of the UID tray icon.
Uflags indicates which Members in the structure contain valid data. Optional values: nif_icon, nif_message, nif_tip, nif_state, nif_info, and nif_guid.
The ID of the ucallbackmessage callback message, which is customized by the user. Associated with a custom message processing function.
The handle of the hicon tray icon.
The prompt string of the sztip tray icon.
  Note: The following data members are only valid for the System Shell and common control DLL 5.0 and later versions!
The status of the dwstate icon: nis_hidden-hidden, or nis_sharedicon-visible.
Dwstatemask icon status mask, used to set dwstate
The string of the szinfo balloon prompt (balloon tooltip.
Utimeout display time in milliseconds
Determine the version on which the uversion depends. 0-win95, NOTIFYICON_VERSION-Win2000
Title of the szinfotitle balloon prompt
Dwinfoflags ):

Niif_error
Niif_info
Niif_none no icon
Niif_warning warning
Niif_icon_mask version 6.0 is retained
Niif_nosound is limited to version 6.0 and does not play the corresponding sound.
 
Guiditem 6.0 is retained

The statement with Delphi is as follows:

Statement of policyicondata structure using Delphi
Policyicondata = record
Cbsize: DWORD;
WND: hwnd;
UID: uint;
Uflags: uint;
Ucallbackmessage: uint;
Hicon: hicon;
Sztip: array [0 .. 127] of ansichar;
Dwstate: DWORD;
Dwstatemask: DWORD;
Szinfo: array [0 .. 255] of ansichar;
Utimeoutorversion: uint;
Szinfotitle: array [0 .. 63] of ansichar;
Dwinfoflags: DWORD;
End;

 

3. Return Value: If the call succeeds, the function returns true. Otherwise, the return value is false.

In the shellapi unit of Delphi, the function and its related messages and constants are declared and defined, but different versions have different definitions and definitions.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.