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?
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.