Removing the app's Taskbar button
Posted on 1997-08-29
I'm trying to fill the NOTIFYICONDATA struct and pass it to
Shell_NotifyIcon() to delete my app's icon from the taskbar, but the Shell_NotifyIcon() method fails. ( I'd also like to be able to add its icon in the system tray.)
I create an SDI app with the wizard, and put the following code at the end of InitInstance():
tnid.cbSize = sizeof(NOTIFYICONDATA);
tnid.hWnd = m_pMainWnd->m_hWnd;
tnid.uID = IDR_MAINFRAME;
tnid.uFlags = NIF_ICON;
tnid.hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
tnid.szTip = '\0';
res = Shell_NotifyIcon(NIM_DELETE, &tnid);
I must be setting some of the fields incorrectly. Does someone know how to fill this struct? Am I missing something?
P.S. Is the code/process any different for a dialog-based app?