Hiding icons on the desktop

This article demonstrates how to hide all icons on the desktop.

var

  DesktopWnd : HWND;



procedure TForm1.Button1Click(Sender: TObject);

begin

  DesktopWnd := FindWindow('Progman', 'Program Manager');

  if DesktopWnd > 0 then begin

    DesktopWnd := FindWindowEx(DesktopWnd, 0, 'SHELLDLL_DefView', nil);



    if DesktopWnd > 0 then

      DesktopWnd := FindWindowEx(DesktopWnd, 0, 'SysListView32', nil);

  end;



  if DesktopWnd = 0 then

    ShowMessage('Error - could not find desktop')

  else

    ShowWindow(DesktopWnd, SW_HIDE);

end;

 

Share this article!

Follow us!

Find more helpful articles: