How to get QChar from KeyPress using WinAPI?
-
Dear all,
I try to use like that. But it returns same value for both 'a' & 'A'.How can I get differentiate them by using WinAPI?
That's code is OK with Visual Studio C++. Is this a bug in Qt?
Thanks@LRESULT CALLBACK WinHook::keyboardProcedure(int nCode, WPARAM wParam, LPARAM lParam)
{
if (nCode == HC_ACTION){
if (wParam == WM_KEYDOWN){
KBDLLHOOKSTRUCT p = (KBDLLHOOKSTRUCT) lParam;
BYTE *keyboardState;
keyboardState = new BYTE[256];
if (GetKeyboardState(keyboardState)){
WORD wChar;
int ra = ToAscii((UINT)p->vkCode,(UINT)p->scanCode,keyboardState,&wChar,0);
if (ra>0){
qDebug()<<"wChar is "<<wChar; //return same for both 'a' & 'A'
}
}
}
@