Hide desktop icons

There used to be a nice example in Borland delphi FAQ on how to hide desktop icons.Now it is gone (I cant find it) so if someone has the code....?
srbenavrbeAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
intheConnect With a Mentor Commented:
var
  Handle: THandle;
begin
  Handle := FindWindow('progman', 'Program Manager');
  Handle := GetTopWindow(Handle);
  Handle := GetTopWindow(Handle);
  ShowWindow(Handle, SW_HIDE);
end;

This will hide the actual listView that displays the icons.  It will allow right clicks to continue working so a refresh can be done etc...

TO hide it and disable the right click on the desktop do it like this

var
  Handle: THandle;
begin
  Handle := FindWindow('progman', 'Program Manager');
  //Handle := GetTopWindow(Handle);
  //Handle := GetTopWindow(Handle);
  ShowWindow(Handle, SW_HIDE);
end;

This completely disables the desktop.
  You will have to manually call this again with SW_SHOW
  to bring it back
0
 
hubdogCommented:

 function GetDesktopListViewHandle: THandle;
 var
   S: String;
 begin
 Result := FindWindow('ProgMan', nil);
 Result := GetWindow(Result, GW_CHILD);
 Result := GetWindow(Result, GW_CHILD);
 SetLength(S, 40);
 GetClassName(Result, PChar(S), 39);
 if PChar(S) <> 'SysListView32' then Result := 0;
 end;

Once you have the handle, you can use the list view-related API
functions in the CommCtrl unit to manipulate the desktop. See
the LVM_xxxx messages in the Win32 online help.
such as use LVM_DELETEALLITEMS
to delete all items

good luck

hubdog      
0
 
craig_capelCommented:
hmm, i wrote a simple program that once run, it disables your computer leaving my program running, when i did what barry and hubdog suggests, i could still double click on the form, and it would make the start button pop up, which i did not want and i simply did this to stop it....


wnd:=findwindow('progman',nil);
showwindow(wnd,sw_hide);
wnd:=findwindow('shell_traywnd',nil);
showwindow(wnd,sw_hide);
wnd:=findwindow('#32770',nil);
showwindow(wnd,sw_hide);
systemparametersinfo(spi_screensaverrunning,1,@dummy,0);
setdoubleclicktime(1);  <<this stops the double clicking....

OR...

wnd:=findwindow('progman',nil);
enablewindow(wnd,false);   {put true where false to bring it back}
this allows you to see the icons, but stops you from playing / clicking on them....

and if your wondering what this program is try this link (zipped up file, use at own risk, although there really no risk at all, p.s read the disclaimer with it, since i dont need the hassltle if by chance your computer went faulty at around the same time of running anything i have made)..

I have been told by the people who have put this site together not to give my web sites url out so here instead is a directlink to protect, use on 95 / 98 not NT, not tested on 2000...

if you want anything that the program does, i will be glad to post the source code..

http://members.xoom.com/craig_c/protect.zip
it password protects your computer, read the txt file with it...

All my work is 100% freeware.... although half of it is a waste of time :)

Craig C.
0
 
srbenavrbeAuthor Commented:
Yo Craig,I shall by all means try your suggestion aldough little time right now...
Thanx!
0
All Courses

From novice to tech pro — start learning today.