Trap which key is pressed in different keyboard layouts...
Posted on 2007-04-08
I want to write a function that returns the equilent character of the pressed key on keyboard.
For this reason, I have written a programs that hooks keyboard, when a key is pressed, an event fires and KeyCode and Shift are the input parameters of that sub.
Now I want to recognize which character was pressed, the keyboard have different layouts, for example English, Arabic, Turkish and etc.
I want to trap all keys.
I have found some functions like:
ch=ChrW$(MapVirtualKeyEx(KeyCode, 2, GetKeyboardLayout(GetWindowThreadProcessId(GetForegroundWindow, 0))))
But it does not distimquish between smalls and capital letters and it is workign just for English keyboard layout, not others.
I want a piece of code that ocnverts the KeyCode,Shift and Keyboard layout to a character.
My program is being developed vb Visual Basic 6.0