jeudi 2 avril 2015

Why does VkKeyScanW return -1 for unicode characters?

I am trying to translates characters to the corresponding virtual-key code using VkKeyScanW function. It works well with the ASCII characters but fails when a unicode character (chinese/russian character) is passed.



short vcode = VkKeyScanW(ch); //ch is of wchar_t type;
cout<<"key code:"<<vcode<<endl; //always prints -1 for unicode characters.


What am I doing wrong here? Is there any other way to achieve it? I want to pass the virtual-key code to the SendInput function.


VkKeyScanW function documentation


Aucun commentaire:

Enregistrer un commentaire