Send the key to another windows application using C ++

I'm kind of new to C ++. I am trying to send a key to another application that I know HWND. I was thinking about doing :: SendMessage, but I'm not sure which options to use. I am trying to send a space. Thanks.

+3
source share
2 answers

SendInput may be what you want.

+5
source

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

SendMessage(
    hWnd,
    WM_CHAR,
    ' ', // space
    0);
+3
source

Source: https://habr.com/ru/post/1717385/


All Articles