I have an app that I'm writing a little wizard for. It automated a small part of the app by moving the mouse to appropriate buttons, menus and clicking them so the user can watch.
So far it moves the mouse to a tree item and sends a right-click. That pops up a menu via TrackPopupMenu. Next I move the mouse to the appropriate item on the popup menu. What I can't figure out is how to select the menu item.
I've tried sending left-clicks to the menu's owner window, tried sending WM_COMMAND to the menu's owner, etc. Nothing works.
I suppose the menu is a window in and of itself, but I don't know how to get the HWND for it from the HMENU that I have.
Any thoughts on how to PostMessage a click to the popup menu?
PS I'm using a separate thread to drive the mouse and post messages, so no problems with TrackPopupMenu being synchronous.