Unlike the WM_LBUTTONDOWN messages the WM_CHAR and WM_KEYDOWN events do not send any modifier key status. So you can't send the control key press in the message. So you'll have to do some other stuff to get that key press.
I don't know of any way to send the modifier keys to the program. You may be able to try something like:
Code:
SendDlgItemMessage( hwnd,e_mdichild, WM_KEYDOWN, VK_CONTROL, 0 );
SendDlgItemMessage( hwnd,e_mdichild, WM_KEYDOWN, 89, 0 );
SendDlgItemMessage( hwnd,e_mdichild, WM_CHAR, 89, 0 );
SendDlgItemMessage( hwnd,e_mdichild, WM_KEYUP, 89, 0 );
SendDlgItemMessage( hwnd,e_mdichild, WM_KEYUP, VK_CONTROL, 0 );
Just to make sure all the appropriate key events are sent.
Since you are dealing with a child window (based on teh function calls used) is you can use SetKeyboardState() to mark the control key as pressed, then send the WM_CHAR for key 89. This way whatever method the window uses to detemine that the control key is/isn't down should say that its down. SetKeyboardState() will only effect the thread that calls is, so if your child window was created by a different thread than the one that calls SetKeyboardState() the child window won't see the results. It would look something like this:
Code:
BYTE KeyState[256];
GetKeyState(&KeyState);
//Have the key down high order byte needs to be 1
//how to do that eludes me right now, so I'm just blanketly setting it to 1
//the correct way might be (still not positive on it):
//KeyState[VK_LCONTROL] = 0x00010000;
KeyState[VK_LCONTROL] = 0xFFFFFFFF;
if (SetKeyStates(&KeyState) == FALSE)
{
MessageBox(NULL, "Failed to set key state!", "Error!", MB_OK);
}
SendDlgItemMessage( hwnd,e_mdichild, WM_KEYDOWN, 89, 0 );
I've never used taht before, so I'm not 100% sure thats how it will work.
Beyond those two suggestions I'm not sure what to say, what you are looking for isn't something the Windows API really covers, simulating mouse cliks is easy, keyboard events can be done but not to any real detail. You might be stuck there, since there just isn't any good way to send a modified key press event.