Greetings

Trying to simulate keystrokes using SendMessage. This code works:

HWND notepad = FindWindow(NULL, TEXT("1.txt — Блокнот")); SendMessage(notepad, WM_CLOSE, 0, 0); 

And when I turn, in fact, to the simulation of keystrokes, that is:

 HWND notepad = FindWindow(NULL, TEXT("1.txt — Блокнот")); SendMessage(notepad, WM_KEYDOWN, VK_RETURN, 0); 

, Nothing happens. What to do?

  • What do you think, in the second example, to whom exactly is the keystroke sent? - Sublihim

1 answer 1

Keystrokes are simulated using the SendInput function, not SendMessage.