首页  编辑  

最小化所有窗口

Tags: /超级猛料/OS.操作系统/任务栏/   Date Created:

 keybd_event(91, MapVirtualKey( 91, 0 ), 0 , 0 );  // win 键按下

 keybd_event(77, MapVirtualKey( 77, 0 ), 0 , 0 );  // M 键按下

 keybd_event(77, MapVirtualKey( 77, 0 ), KEYEVENTF_KEYUP , 0 );  // M 键抬起

 keybd_event(91, MapVirtualKey( 91, 0 ), KEYEVENTF_KEYUP , 0 );  // win 键抬起

**************************

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;