Skip to content

Commit

Permalink
Bug #12 Shiftkey issue fix in win8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
manikk committed May 14, 2015
1 parent a7579c9 commit 2c27aa0
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions ekhook/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"
#include "QDebug"

#pragma data_seg(".HOOKDATA") //Shared data among all instances.

Expand Down Expand Up @@ -121,18 +122,21 @@ LRESULT CALLBACK keyboardHookProc_nokeyboard(int nCode, WPARAM wParam, LPARAM lP
PostMessage(callapp_hInst,WM_USER+755,wParam,lParam);

BYTE keyboard_state[256];
GetKeyState(0);
GetKeyboardState(keyboard_state);

WORD wCharacter = 0;

int ta = ToAscii((UINT)p->vkCode, p->scanCode,
keyboard_state, &wCharacter, 0);

if (ta > 0){

if (ta > 0){
//qDebug() << "Char ::: " << wCharacter;
character_pressed = wCharacter;
}

shiftkey_pressed = ((GetKeyState(VK_SHIFT) & 0x80) == 0x80 ? true : false);
//qDebug() << "Shift Key Down"<< ((GetKeyState(VK_SHIFT) & 0x80) == 0x80 );
shiftkey_pressed = ((GetKeyState(VK_SHIFT) & 0x80) == 0x80 ? true : false);
bool caplock_pressed = (GetKeyState(VK_CAPITAL) != 0 ? true : false);
altkey_pressed = ((GetKeyState(VK_MENU) & 0x80 ) == 0x80 ? true : false);
controlkey_pressed = ((GetKeyState(VK_CONTROL) & 0x80) == 0x80 ? true : false);
Expand Down Expand Up @@ -169,9 +173,10 @@ LRESULT CALLBACK keyboardHookProc_nokeyboard(int nCode, WPARAM wParam, LPARAM lP
current_vkCode = p->vkCode ;
BYTE keyboard_state[256];
GetKeyboardState(keyboard_state);
shiftkey_pressed = ((GetKeyState(VK_SHIFT) & 0x80) == 0x80 ? true : false);
shiftkey_pressed = ((GetKeyState(VK_SHIFT) & 0x80) == 0x80 ? true : false);
controlkey_pressed = ((GetKeyState(VK_CONTROL) & 0x80) == 0x80 ? true : false);
altkey_pressed = ((GetKeyState(VK_MENU) & 0x80 ) == 0x80 ? true : false);
altkey_pressed = ((GetKeyState(VK_MENU) & 0x80 ) == 0x80 ? true : false);
//qDebug() << "Shift Key UP"<< ((GetKeyState(VK_SHIFT) & 0x80) == 0x80 );
}

return CallNextHookEx(NULL, nCode, wParam, lParam);
Expand Down

0 comments on commit 2c27aa0

Please sign in to comment.