Reading Desktop icon positions from registry
can you read an ico开发者_Python百科n's location from windows xp registry and once it get identified then set it anywhere on desktop programmatically?
The desktop is a list view control. You can get the position of an individual icon by finding the desktop window and sending it LVM_GETITEMCOUNT and LVM_GETITEMPOSITION messages to it.
Unfortunately, LVM_GETITEMPOSITION requires that lparam is set to a POINT struct within the address space of the process owning the list view (i.e. explorer.exe) so in order to do any of this you need to open the explorer.exe process, allocate some memory within that process, calculate the address of that memory relative to the explorer process, send the LVM_GETITEMPOSITION message with the freshly allocated memory as the lparam and, finally, read the contents of that memory. It's been a long time since I've done any of this, so I don't remember the details but hopefully this helps you along.
精彩评论