Moving icons on Desktop

Posted on 2005-03-03
Medium Priority
Last Modified: 2011-09-20

I would like to ask how can I  list all icons on the desktop and then send message to one of them to move somewhere.

Question by:Murdoc
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
LVL 11

Assisted Solution

ZhaawZ earned 160 total points
ID: 13454879
A short sample of getting a handle of 'desktop' (actually - a listview (SysListView32) control that holds icons) and a count of icons.

  wnd : cardinal;
  cnt : integer;
wnd := FindWindow('progman', 'Program Manager');
wnd := FindWindowEx(wnd, 0, 'SHELLDLL_DefView', nil);
wnd := FindWindowEx(wnd, 0, 'SysListView32', 'FolderView');
cnt := SendMessage(wnd, $1004{lvm_getitemcount}, 0, 0);
ShowMessageFmt('There are %d icons', [cnt]);

Haven't found a way to get labels and positions for icons yet. I could try it next evening - it's too late now (1:45AM) ;)
I hope this helps

Author Comment

ID: 13456721
will check this out in few 'cause going out of town :)
LVL 20

Accepted Solution

Madshi earned 160 total points
ID: 13456836
The problem is that using list view messages over process boundaries only work that easily when no pointers are contained in the messages. Otherwise you run into problems.

An easy solution would be to use madShell, with which you could e.g. do this:

uses madShell;

  Desktop.Item('My Computer').Position := Point(500, 500);

madShell is free for non-commercial usage. Here's the online documentation:


If you don't want to use a 3rd party component like madShell, then I suggest that you write a little hook dll which you inject into the explorer by using SetWindowsHookEx. This dll could then use the list view messages to do what you want.

Author Comment

ID: 13479165
have to split points between both of you...hope it will be fair

Thanks for help


Author Comment

ID: 13479215
oops have no idea how to choose which answer should be accepted and which one suppose to be assisted....


Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month13 days, 4 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question