void anyKey(char key[20]){
//copy paste
INPUT ip;
ip.type = INPUT_KEYBOARD;
ip.ki.wScan = 0;
ip.ki.time = 0;
ip.ki.dwExtraInfo = 0;
//pressed any given key
ip.ki.wVk = key;
ip.ki.dwFlags = 0; // 0 for key press
SendInput(1, &ip, sizeof(INPUT));
//released any given key
ip.ki.wVk = key;
ip.ki.dwFlags = KEYEVENTF_KEYUP;
SendInput(1, &ip, sizeof(INPUT));
}
I want to send vKeys from another funtion to here.
For eg: anyKey("0x44"); or anyKey("VK_ESCAPE");
I tried string also. its giving me this error:
invalid conversion from 'char*' to 'WORD {aka short unsigned int}' [-fpermissive]|
cannot convert 'std::__cxx11::string {aka std::__cxx11::basic_string}' to 'WORD {aka short unsigned int}' in assignment|
Aucun commentaire:
Enregistrer un commentaire