• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2391
  • Last Modified:

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.
0
craig_capel
Asked:
craig_capel
  • 2
  • 2
  • 2
  • +1
1 Solution
 
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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

 
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
 
craig_capelAuthor Commented:
Perfecto!!!!!!!!!!!!!

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


Craig C.
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

  • 2
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now