...minimize all windows?

Author: Rainer Kümmerle
Homepage: http://www.thinklazy.de

Category: System

procedure TForm1.Button1Click(Sender: TObject);
var
  
h: HWnd;
begin
  
h := Handle;
  while h > 0 do
  begin
    if 
IsWindowVisible(h) then
      
PostMessage(h, WM_SYSCOMMAND, SC_MINIMIZE, 0);
    h := GetNextWindow(h, GW_HWNDNEXT);
  end;
end;

// Or Simulate Win + M:

procedure TForm1.Button1Click(Sender: TObject);
begin
  
Keybd_event(VK_LWIN, 0, 0, 0);
  Keybd_event(Byte('M'), 0, 0, 0);
  Keybd_event(Byte('M'), 0, KEYEVENTF_KEYUP, 0);
  Keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0);
end;

 

printed from
www.swissdelphicenter.ch
developers knowledge base