Hide icons on the Desktop

Posted in System

First of all, you should find handle of the window, which are the desktop. And after that, you may work with it like with any other window.

// Hide icons on the Desktop
procedure TForm1.Button2Click(Sender: TObject);
begin
  ShowWindow(DesktopListViewHandle, SW_HIDE);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  DesktopListViewHandle:=FindWindow('ProgMan', nil);
  DesktopListViewHandle:=GetWindow(DesktopListViewHandle, GW_CHILD);
  DesktopListViewHandle:=GetWindow(DesktopListViewHandle, GW_CHILD);
end;

// Show icons on the Desktop
procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowWindow(DesktopListViewHandle, SW_SHOW);
end;