Tray Icons
-
Hi i have a dialog based app and im trying to add a tray icon i can get the icon to display but whenever you move the mouse into the tray it dissapears here is the code i have for it niData is stored in the class and is zeroed in the constructor void CWinDEDlg::InitTrayIcon() { niData.cbSize = sizeof(NOTIFYICONDATA); niData.uID = TRAY_ID; niData.uFlags = NIF_ICON|NIF_MESSAGE|NIF_TIP; niData.hIcon = (HICON)m_hIcon; niData.hWnd = (HWND)this; niData.uCallbackMessage = ICON_MESSAGE; Shell_NotifyIcon(NIM_ADD, &niData); } does anyone know why the icon just dissapears?
-
Hi i have a dialog based app and im trying to add a tray icon i can get the icon to display but whenever you move the mouse into the tray it dissapears here is the code i have for it niData is stored in the class and is zeroed in the constructor void CWinDEDlg::InitTrayIcon() { niData.cbSize = sizeof(NOTIFYICONDATA); niData.uID = TRAY_ID; niData.uFlags = NIF_ICON|NIF_MESSAGE|NIF_TIP; niData.hIcon = (HICON)m_hIcon; niData.hWnd = (HWND)this; niData.uCallbackMessage = ICON_MESSAGE; Shell_NotifyIcon(NIM_ADD, &niData); } does anyone know why the icon just dissapears?
I'm guessing it's because you've given the shell a zero length tooltip. Try removing the NIF_TIP flag. Though windows should just "shrug" and move on... Do you have a handler for ICON_MESSAGE? If so, does it get called before the icon disappears? Is your m_hIcon still valid? Iain.