?
Solved

Moving icons on Desktop

Posted on 2005-03-03
5
Medium Priority
?
203 Views
Last Modified: 2011-09-20
Hi

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.

Regards
0
Comment
Question by:Murdoc
[X]
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
5 Comments
 
LVL 11

Assisted Solution

by:ZhaawZ
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.

var
  wnd : cardinal;
  cnt : integer;
begin
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]);
end;


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
0
 

Author Comment

by:Murdoc
ID: 13456721
will check this out in few 'cause going out of town :)
thenks
regards
0
 
LVL 20

Accepted Solution

by:
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;

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

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

http://help.madshi.net/madShell.htm

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.
0
 

Author Comment

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

Thanks for help

Regards
0
 

Author Comment

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

regards
0

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