keybd_event()The keybd_event function synthesizes a keystroke. The system can use such a synthesized keystroke to generate a WM_KEYUP or WM_KEYDOWN message. The keyboard driver's interrupt handler calls the keybd_event function. VOID keybd_event( BYTE bVk, // virtual-key code
BYTE bScan, // hardware scan code
DWORD dwFlags, // flags specifying various function options
DWORD dwExtraInfo // additional data associated with keystroke
);
ParametersbVkSpecifies a virtual-key code. The code must be a value in the range 1 to 254. bScanSpecifies a hardware scan code for the key. dwFlagsA set of flag bits that specify various aspects of function operation. An application can use any combination of the following predefined constant values to set the flags: Value Meaning
KEYEVENTF_EXTENDEDKEY If specified, the scan code was preceded by a prefix byte having the value 0xE0 (224).
KEYEVENTF_KEYUP If specified, the key is being released. If not specified, the key is being depressed.
dwExtraInfoSpecifies an additional 32-bit value associated with the key stroke. Return ValuesThis function has no return value. ResAlthough keybd_event passes an OEM-dependent hardware scan code to Windows, applications should not use the scan code. Windows converts scan codes to virtual-key codes internally and clears the up/down bit in the scan code before passing it to applications.
An application can simulate a press of the PRINTSCREEN key in order to obtain a screen snapshot and save it to the Windows clipboard. To do this, call keybd_event with the bVk parameter set to VK_SNAPSHOT, and the bScan parameter set to 0 for a snapshot of the full screen or set bScan to 1 for a snapshot of the active window. See AlsoGetAsyncKeyState, GetKeyState, MapVirtualKey, SetKeyboardState
BYTE bScan, // hardware scan code
DWORD dwFlags, // flags specifying various function options
DWORD dwExtraInfo // additional data associated with keystroke
);
ParametersbVkSpecifies a virtual-key code. The code must be a value in the range 1 to 254. bScanSpecifies a hardware scan code for the key. dwFlagsA set of flag bits that specify various aspects of function operation. An application can use any combination of the following predefined constant values to set the flags: Value Meaning
KEYEVENTF_EXTENDEDKEY If specified, the scan code was preceded by a prefix byte having the value 0xE0 (224).
KEYEVENTF_KEYUP If specified, the key is being released. If not specified, the key is being depressed.
dwExtraInfoSpecifies an additional 32-bit value associated with the key stroke. Return ValuesThis function has no return value. ResAlthough keybd_event passes an OEM-dependent hardware scan code to Windows, applications should not use the scan code. Windows converts scan codes to virtual-key codes internally and clears the up/down bit in the scan code before passing it to applications.
An application can simulate a press of the PRINTSCREEN key in order to obtain a screen snapshot and save it to the Windows clipboard. To do this, call keybd_event with the bVk parameter set to VK_SNAPSHOT, and the bScan parameter set to 0 for a snapshot of the full screen or set bScan to 1 for a snapshot of the active window. See AlsoGetAsyncKeyState, GetKeyState, MapVirtualKey, SetKeyboardState
解决方案 »
- Openfiledialog打开文件,怎样得到文件名字,而不是一大串路径。谢谢!
- 在 VB 中取一段字符的拼音首字母
- 关于用时间插件选择数据库中的一段时间删除?
- 请问如何让得到程序的物理路径?
- 如何在查询中忽略空文本框的内容
- 各位朋友,请帮助我解决一个问题好吗?谢谢您的支持,我在线等候,同时也感谢昨天送给我分数的朋友!
- 如何取消textbox的右键菜单????谢谢
- 改变DBGrid中一个格子的程序(菜鸟请教)
- 如何在模块中调用窗体的事件??????
- 如何读写一个BINARY文件
- 求助!用vb自带的access97数据库,为何看不到第一条记录的第一个字段?
- listview(report格式) 怎么写让指定的一行被选中????node.selected=true不行,
Const KEYEVENTF_KEYUP = &H2
Const VK_LWIN = &H5B ' 77 为'M'
Call keybd_event(VK_LWIN, 0, 0, 0) ‘win键按下
Call keybd_event(77, 0, 0, 0) ’m键按下
Call keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0) ‘win键弹起