In fact, not complicated, mainly used to TNotifyIconData this structure under shellAPI:
typedef struct _NOTIFYICONDATA { DWORD cbSize; // size of the structure, in bytes HWND hWnd; // window handle UINT uID; // identifier taskbar icon application-defined UINT uFlags; // This member show specific data which other members of the legal UINT uCallbackMessage; // messaging application-defined label HICON hIcon; // add, modify or delete the icon handle TCHAR szTip [ 64- ]; // points to an end to the / 0 character string pointer DWORD dwState; // Version 5.0, the icon status DWORD dwStateMask; //Those members dwState specified bit Version 5.0 may be provided or accessed TCHAR szInfo [ 256 ]; // content to point to a string / 0 end pointer string to the balloon contents to Union { UINT The uTimeOut; // represents balloon tips timeout time, in milliseconds, after which time the balloon prompt will disappear UINT uVersion; // to set the use of Windows 95 or Windows 2000-style interface to the message icon }; TCHAR szInfoTitle [ 64 ]; // Pointer to a / 0 terminated string pointer. Contents of the string to the balloon tip title DWORD dwInfoFlags; // set this member used to increase a balloon tip box icon, the icon appears to the left to increase the balloon tip title of the GUID of guidItem; // reserved HICON hBalloonIcon; // use in Windows Vista or higher version of custom balloon icon } NOTIFYICONDATA, *PNOTIFYICONDATA;
Specifically how to use, to functions ->
procedure FillDataStructureandCreate(shint:string;dwFlags:Cardinal); begin with FsysIcon do begin cbSize:=SizeOf(TNotifyIconData); Wnd:=Handle; uID:=Application.Icon.Handle; uFlags:=NIF_MESSAGE or NIF_ICON or NIF_TIP or NIF_INFO; hIcon:=Application.Icon.Handle; StrPCopy(szInfoTitle,'标题'); StrPCopy(szInfo,shint);//shint为内容 dwInfoFlags: = the dwFlags; // prompt icon uCallbackMessage: = CM_ICONDATA; The uTimeOut: = 15 ; uVersion: = NOTIFYICON_VERSION_ 4 ; End ; End ;
transfer
Must first add
FillDataStructureandCreate ( ' right-click the form redisplayed ' , NIIF_INFO); the Shell_NotifyIcon (NIM_ADD, @ FsysIcon);
Custom prompts
FillDataStructureandCreate ( ' service is started ' , NIIF_INFO); Shell_NotifyIcon (NIM_MODIFY, @ FsysIcon);
Delete the last run
Shell_NotifyIcon(NIM_DELETE,@FsysIcon);
FsysIcon which is TNotifyIconData type.