Hi,
This is my code:
Code:
case WM_CREATE:
hInst = (HINSTANCE)GetWindowLong(NULL, GWL_HINSTANCE);
hmenu = LoadMenu(hInst,MAKEINTRESOURCE(IDR_SYSMENU));
hmenu = GetSubMenu(hmenu,0);
Nicon.cbSize = sizeof(NOTIFYICONDATA);
Nicon.hWnd = hWnd;
Nicon.uFlags = NIF_ICON|NIF_MESSAGE|NIF_TIP;
Nicon.hIcon = (HICON)LoadImage(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_ICON1),
IMAGE_ICON,16,16,LR_DEFAULTCOLOR);
Nicon.uCallbackMessage = WM_TRAYMESSAGE;
Nicon.uID = ICONIDENT;
wcscpy(Nicon.szTip, _T("Check"));
Shell_NotifyIcon(NIM_ADD, &Nicon);
break;
case WM_DESTROY:
Shell_NotifyIcon(NIM_DELETE, &Nicon);
PostQuitMessage(0);
return 0;
The problem i am having is that when my program closes, the tray icon is not removed, and it is left in the tray, until i move my mouse over it then it is removed. Any ideas what i have done wrong?
Thanks