我正在嘗試使用VkKeyScanW函數將字符轉換爲相應的虛擬鍵代碼。它適用於ASCII字符,但在傳遞Unicode字符(中文/俄文字符)時失敗。爲什麼VkKeyScanW爲unicode字符返回-1?
short vcode = VkKeyScanW(ch); //ch is of wchar_t type;
cout<<"key code:"<<vcode<<endl; //always prints -1 for unicode characters.
我在這裏做錯了什麼?有沒有其他方法可以實現它?我想將虛擬鍵碼傳遞給SendInput函數。
VkKeyScanW function documentation