News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Systray Icon Problem

Started by Sponge, August 09, 2007, 11:13:15 PM

Previous topic - Next topic

Sponge

Attached is the sourcecode of my program. This is a simple ad closer... but the main problem isn't that.
If you compile it you will see that whenever you click AutoRun (Menu option from systray popup menu) the systray icon will dissapear.
I've made a temporary fix by calling shell_notifyicon right after the menu's function is done. Just wondering if anyone knows how to fix this problem.
Thanks for your time.

[attachment deleted by admin]

Tedd

I think this has a lot to do with it..
    .ELSEIF uMsg == WM_COMMAND
      .IF lParam == 0

        invoke Shell_NotifyIcon, NIM_DELETE, ADDR nid     ; <*******


You're removing the icon on ANY WM_COMMAND message.
This might be a 'shortcut' if you expect to replace it for each path the comes out of that, but even then you'd have to make sure you're handling every WM_COMMAND that could possibly come your way.
Probably a lot better to only remove it when you need to actually remove it (i.e. exit.)
To change the icon there's NIM_MODIFY, which has the benefit of not changing the position of your icon (as removing and re-adding it does.)
No snowflake in an avalanche feels responsible.

Sponge

Wow... that was dumb... i completely overlooked it...  :P even my friend didnt see it... thanks for looking over it.
I cant believe i missed that.  :( ive no idea when i added that. its not even suppose to be there. I probably was going to add it for the Close Menu,
just that i forgot to enclose it in the .IF . This is what you get for staying awake too long.  :P