void keybd_event(
          // virtual-key code
          BYTE bVk, 
          // This parameter is not used,设置为0
          BYTE bScan, 
          // 0KeyDown,KEYEVENTF_KEYUPKeyUp
          DWORD dwFlags,
          // additional keystroke data,set to 0
          ULONG_PTR dwExtraInfo );
 
//该函数产生一次击键事件。
 
//例子:模拟按下'N'
keybd_event('N', 0, 0, 0);
Sleep(10);
keybd_event('N', 0, KEYEVENTF_KEYUP, 0);

本文链接地址: 用keybd_event模拟键盘按键
http://qingfengju.com/index.asp?id=194

分类:Win32/C++ 查看次数:6359 发布时间:2010-1-28 10:44:11