在程式中使用 Windows的Task Bar (轉)

worldblog發表於2007-12-10
在程式中使用 Windows的Task Bar (轉)[@more@]在中使用 的Task Bar。 Windows的Task Bar是一標準。 使用到的結構是NOTIFYICONDATA: typedef struct _NOTIFYICONDATA { D cbSize; HWND hWnd; UINT uID; UINT uFlags; UINT uCallbackMessage; HICON hIcon; char szTip[64]; } NOTIFYICONDATA, *PNOTIFYICONDATA; Contains information that the system needs to process taskbar status area messages. cbSize :Size of this structure, in bytes. hWnd : Handle to the window that will receive notification messages associated with an icon in the taskbar status area. uID :Application-defined ntifier of the taskbar icon. uFlags: Array of flags that indicate which of the other members contain valid data. This member can be a combination of the following: NIF_ICON The hIcon member is valid. NIF_MESSAGE The uCallbackMessage member is valid. NIF_T The szTip member is valid. uCallbackMessage : Application-defined message identifier. The system uses this identifier for notification messages that it sends to the window identified in hWnd. These notifications are sent when a mouse event occurs in the bounding rectangle of the icon. hIcon :Handle to the icon to add, modify, or delete. szTip : Tooltip text to display for the icon. 使用的通訊是_NotifyIcon: WINSHELL BOOL WINAPI Shell_NotifyIcon( DWORD dwMessage, PNOTIFYICONDATA pnid); Sends a message to the system to add, modify, or delete an icon from the taskbar status area. Returns nonzero if succesul, or zero otherwise. dwMessage : Message value to send. This parameter can be one of these 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. pnid : Address of a NOTIFYICONDATA structure. The content of the structure depends on the value of dwMessage. 透過上面的結構和函式可以很容易把我們的程式做得更加professional.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10752043/viewspace-990728/,如需轉載,請註明出處,否則將追究法律責任。

相關文章