1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
int main(array<System::String ^> ^args)
{
// Enabling Windows XP visual effects before any controls are created
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
// Create the main window and run it
HWND hWnd;
NOTIFYICONDATA nid = {};
nid.cbSize = NOTIFYICONDATA_V2_SIZE;
nid.hWnd = hWnd;
nid.uFlags = NIF_ICON | NIF_INFO |NIF_TIP |NIF_SHOWTIP ;
nid.dwInfoFlags =NIIF_ERROR;
nid.uVersion = NOTIFYICON_VERSION_4;
static const GUID myGUID =
{0x23977b55, 0x10e0, 0x4041, {0xb8, 0x62, 0xb1, 0x95, 0x41, 0x96, 0x36, 0x69}};
nid.guidItem = myGUID;
strcpy(nid.szTip, "My application");
strcpy(nid.szInfoTitle, "Test application ");
strcpy(nid.szInfo, "Test application\n Hello World !!");
nid.hIcon = (HICON)LoadImage(NULL,"C:/TaskbarDemo.ico",IMAGE_ICON,0,0,LR_LOADFROMFILE);
Shell_NotifyIcon(NIM_ADD, &nid) ;
Shell_NotifyIcon(NIM_SETVERSION, &nid);
Sleep(5000);
Shell_NotifyIcon(NIM_DELETE, &nid) ;
|