【问题标题】:How to minimize all applications except mine?如何最小化除我之外的所有应用程序?
【发布时间】:2011-11-23 22:06:38
【问题描述】:

我想最小化系统中运行的所有应用程序,除了我的。 我怎样才能做到这一点?

我使用了这段代码,但它只适用于一些计算机:

procedure MinAllWnd_ByShell;
VAR IntHwnd: Integer;
begin
 IntHwnd:= FindWindow('Shell_TrayWnd', nil);
 PostMessage(IntHwnd, WM_COMMAND, 419, 0);
end;

然后

procedure TFrmMain.btnMinimizeAll_Click(Sender: TObject);
begin
 { Send MINIMIZE message }
 MinAllWnd_ByShell;                                                            { This sends a message to Windows. Windows sends the minimize signal back to us after a delay }
 Delay(150);                                                                   { We wait few miliseconds to receive the message in our message queue }
 Application.ProcessMessages;                                                  { By now we should have received the message so we process the queue. }

 { Now self restore }
 BringToFront;
 ShowWindow(frmMain.Handle, SW_RESTORE);
end;

.


德尔福 XE/Win XP/Win 7

【问题讨论】:

标签: delphi winapi shell minimize


【解决方案1】:

我并不是说这是个好主意,但您可以尝试用模拟的 Win+M 替换 419

keybd_event(VK_LWIN, 0, 0, 0);
keybd_event(ord('M'), 0, 0, 0);
keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-20
    • 1970-01-01
    • 2010-09-13
    • 2012-01-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多