2011-11-23 3 views
0

광산을 제외한 시스템에서 실행중인 모든 응용 프로그램을 최소화하고 싶습니다. 어떻게해야합니까? 광산을 제외한 모든 애플리케이션을 최소화하는 방법은 무엇입니까?

은이 코드를 사용하지만, 그것은 단지 일부 에있는 컴퓨터 작동 :

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/윈 XP/윈도우 7

+3

419 조금 비공식적 인 느낌이 ... –

+0

BringToFront를 더 지연 시키면 지연 (1500)은 어떻게됩니까? –

+0

해당 시스템에 설치된 것을 완전히 제어 할 수 없다면이 작업을 신뢰할 수 없으며 그렇게 할 수 없습니다. 이것은 [다른 맨 위 창에 의해 결코 커버되지 않는 맨 위 창을 만드는 방법]과 유사합니다. (http://blogs.msdn.com/b/oldnewthing/archive/2011/03/10/10138969.aspx) –

답변

3

나는 이것이 좋은 생각 말하고 있지 않다, 그러나 당신은 시뮬레이션 승리 + M으로 419를 대체하기 위해 시도 할 수 :

keybd_event(VK_LWIN, 0, 0, 0); 
keybd_event(ord('M'), 0, 0, 0); 
keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0); 
관련 문제