使用SendInput模拟按键,代码如下:
#include "stdafx.h"
#include <windows.h>
#include <conio.h>
#define KEY_TO_FIRE VK_RWIN
int _tmain(int argc, _TCHAR* argv[])
{
_tprintf(_T("fire key...\n"));
INPUT keyEvent = {
0};
keyEvent.type = INPUT_KEYBOARD;
keyEvent.ki.wVk = KEY_TO_FIRE;
keyEvent.ki.wScan = MapVirtualK