如何模拟系统热键,如Win+R、Win+E等?在线等待。 ( 积分: 300 )

  • 主题发起人 主题发起人 lugan0720
  • 开始时间 开始时间
L

lugan0720

Unregistered / Unconfirmed
GUEST, unregistred user!
如何模拟系统热键,如Win+R、Win+E等?在线等待。<br>也就是说:<br>在程序中如何执行系统的快捷键?<br>不用按键,点击某个按钮就可以了。
 
procedure&nbsp;TForm1.btn1Click(Sender:&nbsp;TObject);<br>begin<br>{------------Win+E-------------------}<br>&nbsp;&nbsp;keybd_event(91,&nbsp;MapVirtualKey(91,&nbsp;0),&nbsp;0,&nbsp;0);<br>&nbsp;&nbsp;keybd_event(69,&nbsp;MapVirtualKey(69,&nbsp;0),&nbsp;0,&nbsp;0);<br>&nbsp;&nbsp;keybd_event(69,&nbsp;MapVirtualKey(69,&nbsp;0),&nbsp;KEYEVENTF_KEYUP,&nbsp;0);<br>&nbsp;&nbsp;keybd_event(91,&nbsp;MapVirtualKey(91,&nbsp;0),&nbsp;KEYEVENTF_KEYUP,&nbsp;0);<br>{------------Win+R-------------------}<br>&nbsp;&nbsp;keybd_event(91,&nbsp;MapVirtualKey(91,&nbsp;0),&nbsp;0,&nbsp;0);<br>&nbsp;&nbsp;keybd_event(82,&nbsp;MapVirtualKey(82,&nbsp;0),&nbsp;0,&nbsp;0);<br>&nbsp;&nbsp;keybd_event(82,&nbsp;MapVirtualKey(82,&nbsp;0),&nbsp;KEYEVENTF_KEYUP,&nbsp;0);<br>&nbsp;&nbsp;keybd_event(91,&nbsp;MapVirtualKey(91,&nbsp;0),&nbsp;KEYEVENTF_KEYUP,&nbsp;0);<br>end;
 
接受答案了.
 
后退
顶部