tags:

views:

118

answers:

2

I'm sort of new to c++. I'm trying to send a key to another application, which I know the HWND of. I was thinking of doing ::SendMessage but I'm not sure what parameters to use. I'm trying to send the space key. Thanks.

+4  A: 

SendInput might be what you want.

TheUndeadFish
+2  A: 

You want to send the WM_CHAR message with the space key character code as the wParam parameter:

SendMessage(
    hWnd,
    WM_CHAR,
    ' ', // space
    0);
zdan