Laetitia
Laetitia

Reputation: 21

Emulate mouse events with PostMessage without gaining focus (WINAPI)

I emulated the mouse events using PostMessage and tested on the notepad application. I don't want to gain focus of the notepad application by sending mouse events.

The events are received only if I use the ChildWindow of the notepad (ie the white space where you can write) in PostMessage parameters, that means I can't click on the menu of the app (File, Edit ..). Do you have any idea on how to do that without setting the focus?

Upvotes: 2

Views: 926

Answers (1)

Maurizio
Maurizio

Reputation: 194

If you want to use the menu items of a window menu, figure out the menu command ID's and then send them to the main window via the WM_COMMAND message. Use Spy++ to help with the menu command ID's.

Upvotes: 3

Related Questions