PDA

View Full Version : Refreshing System Tray using User32.dll .... how ?


qwerty
06-12-2007, 11:17 AM
ok, this is a fairly common issue i think, so someone probably has a quick and painless solution

scenario = i'm closing a number of other applications from within my project by terminating their process (vicious i know :P) some of them i am restarting at a later point, so after i have finished messing around my tasktray area looks a complete mess until move the mouse over it ... i'm not happy with this and would like it to be cleaner, easiest way i can think to do this is to refresh the tasktray at the end of my scripting.

here is some other info relating to this windows xp bug/feature


http://techsupt.********.com/webcgi/webbatch.exe?techsupt/tsleft.web+********/Systray~Icon~Questions+Refresh~System~Tray~Area.tx t


Now i can see that i need to use addl call on the user32.dll, but not too sure about the specifics of what to write :p

so looking for a little help, cheers :)


EDIT:
or is it possible to adapt the method described here ...

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=140994&SiteID=1

RizlaUK
06-12-2007, 12:15 PM
I don't know that there's any way to do this programatically.

You can refresh the tray but that just repaints it and that won't make the
icon go away. Windows doesn't realize the app is still there until you move
the mouse over it and Windows can't do a callback.

although it might be possible to send a mouse click to the system tray and fool windows, worms send keys will do the job im sure.....i have a go and get back to you

qwerty
06-12-2007, 12:27 PM
repainting it might cause it to re-asses the icons, one of the other things i have read about this issue used the repaint method i think .... its a little over my head lol, but i'm always willing to experiment

speaking of which ... stand by for questions on menu's shortly too :lol as i'm playing with a custom tray menu at the moment, 90% of it works, just need to search how to set things as disabled (such as minimise & restore) depending on the projects current state, it's a shame you cant just add to the original menu instead of replacing it ... also need to learn about ticked items for always on top option ! ... gonna be a busy night :p

qwerty
06-13-2007, 04:57 AM
well i've been messing around with it, but no luck, i dont fully understand the dll call to re-paint the taskbar, so i cant say if that works or not !!

dam it would be so easy if someone had made a small app that when run would refresh the taskbar, then i could simply add it to my project docs folder and run it from the script each time i terminate something :rolleyes