The Desktop Handle

procedure TForm1.Button1Click(Sender: TObject);
var
h: hwnd;
begin
  h:=findwindow('#32769:Desktop',nil);
  showwindow(h,sw_show);
{ void ListView_SetItemPosition32(
   HWND hwnd,
    int iItem,
    nt x,
    int y 3592
   );}
 movewindow(3529,random(100),random(199),639,480,true);
 {  movewindow(3592,1,1,800,600,true);}
end;


3529 is the number of my desktop but as soon as i restart windows, it changes everytime. but you may ask how do i know this number? i wrote a simple program that returns the handle of any window where the mouse cursor is... this program here....

http://members.xoom.com/craig_c/mouse.exe

with that number i am able to move the desktop, link to other question regarding this is.....

http://www.experts-exchange.com/jsp/qShow.jsp?ta=delphi&qid=10238513 

  h:=findwindow('???????',nil);
                            * what goes here?  i used progman, desktop, #32769, etc etc... i  need is the string.


Does anyone know it? pluheeeeezeeeeeee :)

Craig C.
LVL 2
craig_capelAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jeurkCommented:
Hi,
use GetDesktopWindow;

cu
0
intheCommented:
var
  Handle: THandle;
begin
  Handle := FindWindow('progman', 'Program Manager');
0
yingkitCommented:
h:=FindWindow('progman',nil);
This one should work...
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

yingkitCommented:
um.....you should also replace the nil with 'Program Manager'.
inthe's answer works fine.
0
craig_capelAuthor Commented:
well, nope i actually have already tried that, yes it alters it but for some reason, i am not able to move it... like i said before, the program here gives the real handle....

http://members.xoom.com/craig_c/mouse.exe 

if someone could have a look and tell me, i would be very greatfull, thanks


craig c.
0
jeurkCommented:
What about my comment ?
What do you mean by my desktop ?

If you want the handle of the desktop window use getdesktopwindow

if it's not what you want, please reformul
your question because I don't understand
it.

Thanks
0
intheCommented:
ok ,
i clar this up:
here is answer craig needs:

uses commctrl;

procedure TForm1.Button1Click(Sender: TObject);
var
h : hwnd;
begin
h:=FindWindowEx(FindWindowEx(FindWindow('Progman','Program Manager'),0,'SHELLDLL_DefView',''),0,'SysListView32','');
ListView_SetItemPosition(h,2,2,4);

end;


the first 2 is the index number of listview icon to move,the 2,4 is the desktops listview coordinates to move to.


craig want to "move the desktop" what he acyually needs to do is move the top row of icons down to the next row via setitemposistion of listview params.
'SHELLDLL_DefView' is the classname of the desktops listview calling that gets the correct handle..


Regards Barry

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
craig_capelAuthor Commented:
Perfecto!!!!!!!!!!!!!

Thanks........... Worked a treat Barry...


Craig C.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.