请问怎样使桌面上能看得见的窗体全部隐藏?(30分)

  • 主题发起人 主题发起人 hmFeng
  • 开始时间 开始时间
H

hmFeng

Unregistered / Unconfirmed
GUEST, unregistred user!
或者使他们最小化也行!
 
procedure MinimizeAll; <br>var h:HWnd; <br>begin <br>&nbsp; h:=handle; <br>&nbsp; while h &gt; 0 do <br>&nbsp; begin <br>&nbsp; &nbsp; if IsWindowVisible(h) then <br>&nbsp; &nbsp; Postmessage(h,WM_SYSCOMMAND,SC_MINIMIZE,0); <br>&nbsp; &nbsp; h:=GetnextWindow(h,GW_HWNDNEXT); <br>&nbsp; end; <br>end;
 
隐藏桌面:<br>var<br>hDesktop : THandle;<br>begin<br>hDesktop := FindWindow('Progman', nil);<br>ShowWindow(hDesktop, SW_HIDE);<br>end;<br>显现桌面:<br>var<br>hDesktop : THandle;<br>begin<br>hDesktop := FindWindow('Progman', nil);<br>ShowWindow(hDesktop,sw_restore);<br>end;<br><br><br>
 
本程序我已经调试过
 
感谢joove的帮助,但我要的不是隐藏桌面,而是要最小化所有窗口!
 
要最小化所有窗口?xk的方法不是吗?
 
按下 Win+M 键也可以,但是不知道用发送虚拟键值的方法能否实现该功能
 
keybd_event(91, MapVirtualKey( 91, 0 ), 0 , 0 ); &nbsp;// win 键按下<br>&nbsp; keybd_event(77, MapVirtualKey( 77, 0 ), 0 , 0 ); &nbsp;// M 键按下<br>&nbsp; keybd_event(77, MapVirtualKey( 77, 0 ), KEYEVENTF_KEYUP , 0 ); &nbsp;// M 键抬起<br>&nbsp; keybd_event(91, MapVirtualKey( 91, 0 ), KEYEVENTF_KEYUP , 0 ); &nbsp;// win 键抬起<br>
 
//to hmFeng:<br>//隐藏任务栏<br>procedure ShowTaskbar(Visible: boolean);<br>var<br>&nbsp; hTaskBarWindow : HWnd;<br>begin<br>&nbsp; hTaskBarWindow:=FindWindow('Shell_TrayWnd',nil);<br>&nbsp; if hTaskBarWindow&lt;&gt;0 then<br>&nbsp; &nbsp; if Visible then<br>&nbsp; &nbsp; &nbsp; ShowWindow(hTaskBarWindow, SW_SHOW)<br>&nbsp; &nbsp; else<br>&nbsp; &nbsp; &nbsp; ShowWindow(hTaskBarWindow, SW_HIDE)<br>end; <br>//开始按钮<br>procedure EnableButton(Flag:Boolean);<br>begin<br>&nbsp; if Flag then<br>&nbsp; EnableWindow(FindWindowEx(FindWindow('Shell_TrayWnd', nil),0, 'Button', nil),True)<br>&nbsp; else<br>&nbsp; EnableWindow(FindWindowEx(FindWindow('Shell_TrayWnd', nil),0,'Button',nil),False);<br>end;
 
装一个wacthcat的程序就行了<br>要的话我给你发一个
 
请给我一份,谢谢<br>kalituo@263.net
 
接受答案了.
 
后退
顶部