Query the System Tray Using Interprocess Memory Communication

Category:
System/API
Type:
Applications
Difficulty:
Advanced
Author:
Arkadiy Olovyannikov

Version Compatibility: Visual Basic 6, Visual Basic 5

More information:
This application shows you how to send a pointer to a structure filled with data to a window owned by another process. If the windows was owned by your own process, you can use the SendMessage API call for this purpose; but if you try this in communicating with another process, a GPF will occur. In Windows 9x/ME, the workaround it to use File Mapping, because the OS places mapped files into shareable memory space. In NT/2000/XP, files are mapped into the calling process's memory area, so in this case, we can use VirtualAllocEx function to reserve memory inside the target process.

The demo here changes lists all applications running in the system tray using the above mentioned techniques. For this purpose, we need to pass the address of a TOOLTIP structure into the Shell memory space.


Instructions: Click the link below to download the code. Select 'Save' from the IE popup dialog. Once downloaded, open the .zip file from your local drive using WinZip or a comparable program to view the contents.

Download intray.zip