在程序中调用 HideDesktopAllWin 就可以啦
{ ShowWinNoAnimate }
function GetAnimation: Boolean;
var
Info: TAnimationInfo;
begin
Info.cbSize := SizeOf(TAnimationInfo);
if SystemParametersInfo(SPI_GETANIMATION, SizeOf(Info), @Info, 0) then
Result := Info.iMinAnimate <> 0 else
Result := False;
end;
procedure SetAnimation(Value: Boolean);
var
Info: TAnimationInfo;
begin
Info.cbSize := SizeOf(TAnimationInfo);
BOOL(Info.iMinAnimate) := Value;
SystemParametersInfo(SPI_SETANIMATION, SizeOf(Info), @Info, 0);
end;
procedure ShowWinNoAnimate(Handle: HWnd; CmdShow: Integer);
var
Animation: Boolean;
begin
Animation := GetAnimation;
if Animation then SetAnimation(False);
ShowWindow(Handle, CmdShow);
if Animation then SetAnimation(True);
end;
procedure HideDesktopAllWin(Sender: TObject);
function EnumWindowsProc (Wnd: HWND; LParam: LPARAM): BOOL; stdcall;
begin
Result := True;
if (IsWindowVisible(Wnd)) and
(GetWindowLong(Wnd, GWL_HWNDPARENT) = 0) and
(GetWindowLong(Wnd, GWL_EXSTYLE) and WS_EX_TOOLWINDOW = 0) then
begin
ShowWinNoAnimate(Wnd, SW_MINIMIZE);
end;
end;
var
Param : Longint;
begin
Param := 0;
EnumWindows(@EnumWindowsProc , Param);
SetForegroundWindow(FindWindow(PChar('ProgMan'), nil));
SetActiveWindow(FindWindow(PChar('ProgMan'), nil));
end;