From: Magnus Olsson on
When I press CTRL+x, CTRL+ALT+x or CTRL+ALT+SHIFT+x (where x is a
number) I want to send a sequence of chars to another application that
is not I focus. To send the sequence I user following code:

PostMessage(wnd, WM_KEYDOWN, key, 0x1);
PostMessage(wnd, WM_KEYUP, key, 0xC0010001);

It works perfect when I don’t user Ctrl, Alt or Shift, but when I use
them, I get problem. If I e.g. try to send the letter F when I have
Ctrl pressed, the target applications handle it as CTRL+F, but I want
it to ignore the ctrl (I don’t have access to the target applications
source code).

I have try to use SetKeyboardState (together with AttachThreadInput)
to set the keyboard state before I send, and it works sometimes, but
not always.
I have alsow try to use SnedInput to send KEYEVENTF_KEYUP for Ctrl,
Alt and Shift, but it doesn’t help.

Any sugestion how to solv it?