// Variante 1:
procedure TForm1.Button1Click(Sender: TObject);
var h: HWND;
begin
h := findwindow(nil, nil);
repeat
if iswindowvisible(h)
then Showwindow(h, SW_SHOWMINIMIZED); // nicht SW_MINIMIZE
h := getnextwindow(h, GW_HWNDNEXT);
until h = 0;
end;
// Variante 2: Aufwendiger, aber schöner
uses shellapi;
procedure TForm1.Button1Click(Sender: TObject);
const
txt = '[Shell]'#13#10'Command=2'#13#10'[Taskbar]'#13#10 +
'Command=ToggleDesktop';
datei = 'weg~tmp.scf';
var
tf: TFilestream;
s: string;
buf: array[0..max_path - 1] of char;
begin
zeromemory(@buf, max_path);
gettemppath(max_path, buf);
s := buf + datei;
tf := Tfilestream.create(s, fmcreate);
tf.writebuffer(txt[1], length(txt));
tf.free;
shellexecute(handle, 'open', pchar(s), nil, nil, sw_hide);
deletefile(datei);
end;
// Variante 3: empfohlen
uses ComObj;
procedure MinimizeAll;
var
Shell: OleVariant;
begin
Shell := CreateOleObject('Shell.Application');
Shell.MinimizeAll;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
MinimizeAll;
end;