Shuffle Desktop Icons 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 the position of desktop icons and uses the techniques described above to save the original positions, in order to restore them later. For this purpose, we need to pass a POINTAPI 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 shuffledesktop.zip