Shell_NotifyIcon sometimes fails at startup
-
Hi! My application is automatically started when Windows is lauching. Sometimes Shell_NotifyIcon will fail. I do not have an error code since I haven't been to reproduce that bug very often. My guess is that the desktop is not ready or something. Do you think that it would be safe to do something like: BOOL bRes; do { bRes = Shell_NotifyIcon(...); }while(bRes = FALSE); Thanks!
-
Hi! My application is automatically started when Windows is lauching. Sometimes Shell_NotifyIcon will fail. I do not have an error code since I haven't been to reproduce that bug very often. My guess is that the desktop is not ready or something. Do you think that it would be safe to do something like: BOOL bRes; do { bRes = Shell_NotifyIcon(...); }while(bRes = FALSE); Thanks!
I can't remember it exactly (it's in my BugReporter article here on CP), but there's a way you can register a message to notify you when the taskbar gets repainted so that you can put the icon back in the system tray. Otherwise, when explorer.exe crashed and restarted, my icon would be gone from the system tray. I don't know if that helps any, but I tried. :) My articles www.stillwaterexpress.com BlackDice
-
Hi! My application is automatically started when Windows is lauching. Sometimes Shell_NotifyIcon will fail. I do not have an error code since I haven't been to reproduce that bug very often. My guess is that the desktop is not ready or something. Do you think that it would be safe to do something like: BOOL bRes; do { bRes = Shell_NotifyIcon(...); }while(bRes = FALSE); Thanks!
LukeV wrote: Do you think that it would be safe to do something like: No. If there's an error with your input you'll have yourself a nice little infinite loop. I had this happen to me last night, although it happened for all programs. It turned out I had a virus, so I did a system restore and it's all good now :). I doubt that's your problem though. I've never had any problems with applications I've written doing this. I've heard of a few programs that add a few seconds delay during their startup to give Windows time to initialise properly. That might cure the problem. Other than that, there's not much you can do other than verifying that your input is correct.
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"