When I filter all keystrokes on a French keyboard, the Accent keys no longer work.
Im using the SetWindowsHookEx(WH_KEYBOA
RD_LL, MyKeyboardProc, hInst, 0); to install the low-level keyboard hook.
Apparently the call to ToAsciiEx() inside the low-level keystroke hook stops the proper functioning on Accent keys. If I set the keyboard to Canadian French the call to ToAscii() or ToAsciiEx() stops the creation of Accent keys (on an English keyboard, press the [ key followed by the a and you should get a â key.)
There is an ToAsciiEx() which allows me to specify the Input Local. Ive tried that with a similar result. In that call, I get the keyboard local for the foreground window process.
When this hook is active and the keyboard is set to Canadian French, I can no longer get an "accent" key when typing in Notepad, Word, etc... If I deactivate the hook, then I can create an accented letter.
LRESULT CALLBACK MyKeyboardProc(int ccode, WPARAM wParam, LPARAM lParam)
if (ccode == HC_ACTION)
*pkbdllhook = (KBDLLHOOKSTRUCT *)lParam;
dwhkl = 0;
dwhkl = GetKeyboardLayout(GetWindowThreadProcessId(GetForegroundWindow(), NULL));
ToAsciiEx(pkbdllhook->vkCode, pkbdllhook->scanCode, dbKbdState, (LPWORD)szCharBuf, 0, dwhkl);
return (CallNextHookEx(hHook, ccode, wParam, lParam));