2007. október 19., péntek

How to hide and show icons on the Windows Desktop


Problem/Question/Abstract:

I have seen code to hide the taskbar, but is there an API call or Delphi Code to hide the whole desktop except the applications you want to show?

Answer:

Not a single call, you would have to do an enumWindows and hide whatever windows you do not want to show. This hides and shows the icons on the desktop, for example:

procedure TForm1.Button1Click(Sender: TObject);
const
  b: Boolean = false;
var
  wnd: HWND;
begin
  wnd := FindWindow('progman', nil);
  if wnd <> 0 then
  begin
    if b then
      ShowWindow(wnd, SW_SHOW)
    else
      ShowWindow(wnd, SW_HIDE);
    b := not b;
  end
  else
    showmessage('Desktop not found');
end;

Nincsenek megjegyzések:

Megjegyzés küldése