This topic is now archived and is closed to further replies.

Moving Icons

This topic is 5096 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

A friend asked me if I could make a quick program, and it should be simple enough that I might as well. That is, it should be simple if I can find a way to have a program rearrange icons on the desktop. Is this even possible, or is this functionality reserved for Windows itself? I looked around a bit with IActiveDesktop, which I have used for my own wallpaper changing program, but it seems to be only concerned with wallpaper and "Desktop Items." However, although I cannot seem to find a good definition of "desktop items" it seems not to include normal icons for files, folders, and things of that nature on the desktop. In short, is it possible for a program to rearrange these? If so, how? Thanks in advance! -Arek the Absolute

Share this post

Link to post
Share on other sites
Well if I knew what you meant by arrange ..

Well anyway, where is some code that will allow you to use ListView messages to arrange the icons on the desktop.

HWND hwnd = FindWindow("ProgMan", 0);

hwnd = GetWindow(hwnd, GW_CHILD); // skip first child

hwnd = GetWindow(hwnd, GW_CHILD);

char buffer[40];

GetClassName(hwnd, buffer, 39);

if((strcmp(buffer, "SysListView32") == 0))
MessageBox(NULL, "Found Listview", NULL, MB_OK);

SendMessage(hwnd, LVM_ARRANGE, LVA_ALIGNLEFT, 0); //align icons

Edit: fixed formatting

[edited by - Maega on January 6, 2004 1:44:19 AM]

Share this post

Link to post
Share on other sites