I'm using Icz's tray icon tut (#23 I believe) for minimizing my app to the system tray. Everything works's fine, except that the icon remains in the system tray after the app's dialog has been restored. Even after the app is closed, the icon remains in the systray until I move my mouse over the systray and it "refreshes" itself for lack of a better word. DestroyIcon isn't working, (I guess) because the icon wasn't "created by using the CreateIconIndirect (or CreateIcon) function"--winapi helps. Is there anything i can do to programmatically remove the icon from the systray when the app's dialog gets restored (while not minimized) and definitely after EndDialog has been invoked? --4oh4
Posted on 2001-02-12 16:14:00 by 4oh4
I think your problem is in the EndDialog function, try using

invoke PostQuitMessage,NULL
because with EndDialog is that it just closes or hides the dlg box but the program is still running, hence the icon is still there and you be forced to do a Cntl+Alt+Del and kill the prosses. With PostQuitMessage it ends the program entirly. Hope this helps. -brad
Posted on 2001-02-12 17:35:00 by Rage9
I'm sorry rage, but I've tried that already. I've tested this on win98 and winnt. Here's the problem again: 1) When the app is minimized the icon appears in the systray (which is the point). 2) When the app is restored the icon is still in the systray (no big deal but I'd like to fix it. 3) When the app is closed (by any method...my exit button or the control box "x" button...), the icon is still there until I move my mouse over the systray. Then, apparently the systray 'refreshes' and the icon disappears. Anyone else have any ideas? --4oh4
Posted on 2001-02-12 19:49:00 by 4oh4
I've checked Icz's executable from that tut and his works flawlessly so I've no doubt missed something. I'll double everything.
Posted on 2001-02-13 13:12:00 by 4oh4
hi 4oh4, II know your problem, I had the exactly the same pb when I made a prog (it is on the Icz site at WindowShutdown): -for the restore pb: ;;;;;;;;;;; .elseif wParam==IDM_RESTORE;get from the menu invoke Shell_NotifyIcon,NIM_DELETE,addr note ;;;;add this to ;;;remove the Icon from the tray invoke ShowWindow,hWin,SW_RESTORE ;restore the window ;;;;;;;;;;; For the exiting pb, add the same thing (the one with NIM_DELETE) and your icon will be removed. Vom-bonjour:-()
Posted on 2001-02-13 13:25:00 by Vom-bonjour:-()
Thanks Vom, I just noticed that myself and was about to post a "I just figured out my silly mistake" message. Thanks though, two pairs of eyes and two brains usually increase the odds of finding little errors like that. --4oh4
Posted on 2001-02-13 14:06:00 by 4oh4