[ACCEPTED]-How can I programmatically manipulate Windows desktop icon locations?-utility
If I'm not mistaken the desktop is just 7 a ListView, and you'll have to send the 6 LVM_SETITEMPOSITION message to the handle of the desktop.
I 5 googled a bit for some c# code and couldn't 4 find a example, but I did found the following 3 article. Torry: ...get/set the positions of desktop icons?. It's delphi code, but I find 2 it very readable and with some P/Invokes 1 you'll be able to translate it to c#.
The desktop is just a ListView control and 14 you can get its handle and send messages 13 to it to move icons around using LVM_SETITEMPOSITION.
Getting 12 icon positions using LVMGETITEMPOS is a 11 bit more complicated, though. You have to 10 pass a pointer to a POINT structure as your 9 LPARAM. If you try to do that, you will 8 likely crash Explorer. The problem is you 7 passed it a pointer in your address space, which 6 the control interpreted as a pointer in 5 Explorer's address space. Ouch!
The solution 4 I've used is to inject a DLL into the Explorer 3 process and send the message from there. Then 2 you just have to have a way to get the position 1 info back to your process.
I am still looking into this and will post 5 the result once I finally get something 4 working. I'm posting this because, thanks 3 indirectly to Davy's post, I also found 2 a classic VB implementation:
Shuffle Desktop Icons Using Interprocess Memory Communication
and that will 1 probably be the basis for my code.
I have no idea about the API, but I know 11 Ultramon (http://www.realtimesoft.com/ultramon/) has a feature included for preserving 10 icon placement (although I've never used 9 it for preserving icon location, it is indispensable 8 for multiple monitor usage). The latest 7 beta release works flawlessly with Vista 6 (except for sometimes having a minor glitch 5 or two when initially logging into my machine 4 via RDP), and of course, haven't had any 3 issues with XP. I've used it for over four 2 years now.
And did I mention that it's the 1 best utility for multiple monitor usage?
may be you want this one?I find it in 《WindowsCoreProgramming 1 5th》 https://github.com/wang1902568721/WindowsCoreProgramming
More Related questions