Code   InformationDownload
Information System Tray.

Here's a little demo of how to write an application that lives in the system tray (that's the bit in the bottom right of your task-bar, by the clock). All it does is monitor the amount of memory you've got available on your system. It's a demo, alright? It's not supposed to be brilliant.

Anyway, download the zip and have a look at the code. Or just run the executable. When it's running, click 'Close' to end the program or 'OK' to hide it in the system tray. Then you'll be able to double click the little icon in the system tray to re-activate the program. Magic.

The important functions are (fairly obviously) the calls to 'Shell_NotifyIcon', these are more or less self explanatory. What's not explained properly (unless I'm stupid and can't find the right bit of documentation. Yeah, that's probably it) is how your window (the 'hWnd' member of the NOTIFYICONDATA structure) gets told about actions the user performs on it's system tray icon.

As far as I can tell this is done through a message with the ID that you specified for the 'uCallbackMessage' member in the NOTIFYICONDATA structure. The mouse event that ocurred in the system tray is passed as lParam, wParam is the 'uID' member of the NOTIFYICONDATA structure. That's how I think it works, that's the method I've used here and it seems to work. Anyone know any different?
 




G.E.M