如题……
解决方案 »
- CHttpFile中的ReadString怎么只能读第一行?
- error C2248: 'CObject::CObject' : cannot access private member declared in class 'CObject
- 如何在对话框中加入滚动条??
- 怎样在CListCtrl中,实现把标题变为二行,并且其中几列进行合并为一个单元格?
- 用Installshield 如何对驱动程序进行打包 文件是 *.inf 和 *.sys
- 有没有好方法学VC
- 100分,2个问题,关于类的使用!!!!!!!!
- 请教:为什么MFC中的析构函数都要定义成虚的???
- 如何在windows网络属性中设置的DNS地址?
- 如何获得日历控件上选择的日期?
- 紧急求助,MFC中如何判断Num Lock键是否打开?
- 关于类的问题
BYTE bScan,
DWORD dwFlags,
PTR dwExtraInfo
);
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.ParametersbVk
[in] Specifies a virtual-key code. The code must be a value in the range 1 to 254. For a complete list, see Virtual-Key Codes.
bScan
This parameter is not used.
dwFlags
[in] Specifies various aspects of function operation. This parameter can be one or more of the following values.
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.
dwExtraInfo
[in] Specifies an additional value associated with the key stroke.
Return ValueThis function has no return value.
#include <windows.h> void SetNumLock( BOOL bState )
{
BYTE keyState[256]; GetKeyboardState((LPBYTE)&keyState);
if( (bState && !(keyState[VK_NUMLOCK] & 1)) ||
(!bState && (keyState[VK_NUMLOCK] & 1)) )
{
// Simulate a key press
keybd_event( VK_NUMLOCK,
0x45,
KEYEVENTF_EXTENDEDKEY | 0,
0 ); // Simulate a key release
keybd_event( VK_NUMLOCK,
0x45,
KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,
0);
}
} void main()
{
SetNumLock( TRUE );
}