+2  A: 
  1. stop using ToAscii() and use ToUncode()
  2. remember that ToUnicode may return you nothing on dead keys - this is why they are called dead keys.
  3. Any key will have a scancode or a virtual key code but not necessary a character.

You shouldn't combine the buttons with characters - assuming that any key/button has a text representation (Unicode) is wrong.

So:

  • for input text use the characters reported by Windows
  • for checking button pressed (ex. games) use scancodes or virtual keys (probably virtual keys are better).
  • for keyboard shortcuts use virtual key codes.
Sorin Sbarnea
I tried using ToUnicode(), but the same thing happens... the "dead-key" is destroyed, and so a double-accent is shown when I press the accent key, and I can't make any accented letters. Uninstalling the hook immediately fixes the issue. Not calling ToAscii() or ToUnicode() immediately fixes the issue as well.
00010000
Try to make a copy of keyboard state structure in order to prevent Windows from altering the original one.
Sorin Sbarnea
A: 

Call 'ToAscii' function twice for a correct processing of dead-key, like in:

int ta = ToAscii((UINT)kbHookData->vkCode, kbHookData->scanCode,
                 keyboard_state, &wCharacter, 0);
int ta = ToAscii((UINT)kbHookData->vkCode, kbHookData->scanCode,
                 keyboard_state, &wCharacter, 0);
If (ta == -1)
 ...
Blue eyes