Advertisement

06.03.2008 at 09:44AM PDT, ID: 23453780
[x]
Attachment Details

LowLevel Keystroke Hook removes Accents on French Keyboard

Asked by dddogget in Windows Programming

Tags: Win32 C++

When I filter all keystrokes on a French keyboard, the Accent keys no longer work.

Im using the SetWindowsHookEx(WH_KEYBOARD_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.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
LRESULT CALLBACK MyKeyboardProc(int ccode, WPARAM wParam, LPARAM lParam)
{
if (ccode == HC_ACTION)
{
   KBDLLHOOKSTRUCT 
     *pkbdllhook = (KBDLLHOOKSTRUCT *)lParam;
    HKL
      dwhkl = 0;
    BYTE
      dbKbdState[256];
    TCHAR
      szCharBuf[32];
 
    GetKeyboardState(dbKbdState);
    dwhkl = GetKeyboardLayout(GetWindowThreadProcessId(GetForegroundWindow(), NULL));
    ToAsciiEx(pkbdllhook->vkCode, pkbdllhook->scanCode, dbKbdState, (LPWORD)szCharBuf, 0, dwhkl);
}
 
return (CallNextHookEx(hHook, ccode, wParam, lParam));
}
[+][-]06.03.2008 at 11:42AM PDT, ID: 21703200

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 11:51AM PDT, ID: 21703306

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 03:09PM PDT, ID: 21705048

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 03:32PM PDT, ID: 21705196

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 05:23PM PDT, ID: 21705667

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 08:00PM PDT, ID: 21706502

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Windows Programming
Tags: Win32 C++
Sign Up Now!
Solution Provided By: chikoto
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628