发信人: redfox (Z掉了几乎所有的版...), 信区: BorlandDev
标 题: Delphi编程 -- 12.9 发出一个Alt+Down 组合键
发信站: 哈工大紫丁香 (2000年09月01日17:29:46 星期五), 站内信件
发出一个Alt+Down 组合键
问:Send [Alt]+[Down]?
答:
Use the keybd_event API function to fake keyboard events. Note that
each
key down event needs a matching key up or you mess up the key state
array.
keybd_event( VK_MENU, MapVirtualKey( VK_MENU, 0 ), 0 , 0 );
// Alt down
keybd_event( VK_DOWN, MapVirtualKey( VK_DOWN, 0 ), 0 , 0 );
// down arrow key down
keybd_event( VK_DOWN, MapVirtualKey( VK_DOWN, 0 ), KEYEVENTF_KEYUP , 0
);
// down arrow key up
keybd_event( VK_MENU, MapVirtualKey( VK_MENU, 0 ), KEYEVENTF_KEYUP , 0
);
// Alt key up
These key events will go to the window currently having the input
focus.
--
※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: 202.118.227.107]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:3.639毫秒