-
I have written an app that runs in the systray of windows to manage the app suite i have created. The problem is, when i close the app (by having vb send an End statement), the icon for the app still appears until i move my mouse over the systray. Is there a way i can remove the icon before closing down the app so it is gone right away? I don't want to confuse my customers too much.
-
First, don't use end, it might not unload everything in your app, eating up memory and resources.
Then, are you using an activeX that works with the system tray or do you have your own code to do it?
-
Method
I'm using an end statment that then lets the queryunload procedure run. This unloads the form i enacpsulated the systray icon stuff in and then sets the variable to nothing. In the queryunload procedure of the form that has the icon stuff, i run the Shell_notifyIcon function with NIM_DELETE as the flag. This runs fine, it just doesn't refresh the desktop/systray after doing it. What i need is to somehow tell the systray to refresh so the icon disappears.
-
Put a break in the querry unload and see if it stops there, or else you should unload the form with unload command
-
This works fine at my machine:
Shell_NotifyIcon NIM_DELETE, nid
I wouldn't use the end statement. If the problem persists, you could try sending a WM_PAINT message to the systray.
Sorry I couldn't be of much help.
-
I guess that's my ultimate question. How do i send a WM_PAINT message to the systray?
-
My tray app, have no wm_paints in it, and it works fine. Do you want the source?
-
Sure, i'll give anything a shot.
-
-
I have to correct myselve. Although sending a WM_PAINT message would refresh the systray, this should not be necesary if the icon was deleted successfully. If the icon was not deleted successfully refreshing the systray would only delete the icon, if the app that placed it there was not running anymore, so this would not help.
The only thing I can think about is that you might have declared the nid local to a procedure. When deleting the icon, you would send an empty NOTIFYICONDATA structure, and the delete would fail. If this is the case, declare the variable at module level (Private or Public as appropriate).
I know this is far fetched, but it is (next to the End statement) the only thing I can think about.
-
Try my code at
http://vbcity.com/vbcode/en/click.asp?id=42
it's working perfectly. Don't forget to place the DeleteIcon() into Form_Unload() method.
Regards
-
Well i tried to look at kedaman's code, but i get a file not found error. Then when i try to go to his site, i'm greeted with the notification that a virus is being installed on my PC. Thanks. I also tried smalig's site, but my DNS server can't find vbcity.com anywhere.
-
What file is missing? Any error messages?
Don't worry about the virus, my homepages do that to everyone that visits it.
-
What i mean is that when i try to follow your URL link, is says Error 404 File not found. Is it possible you didn't make it readable to the world(everyone)?
-
Well, my page is totally reincarnated:
http://www.geocities.com/kedasu