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

intheCommented:
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

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