paulohr
paulohr

Reputation: 586

Send keys without SendMessage and PostMessage

Is it possible to send keys to a program without SendMessage and PostMessage API?

Upvotes: 2

Views: 2290

Answers (1)

David Heffernan
David Heffernan

Reputation: 612854

The official way to fake input does not involve sending or posting Windows messages directly. Instead you are meant to call SendInput.

When you use SendInput it is indistinguishable from actually pressing the real keys. When you call SendInput to fake keyboard input, the system ultimately posts messages to the message queue of the foreground thread that created the window with the keyboard focus.

Upvotes: 17

Related Questions