title: How to programmatically choose a context menu item in another app?
body: <p>The target app is written in Delphi (win32 not .NET) and is closed-source.</p>
  
  <p>The action I want to invoke is called Copy, but there is no obvious keyboard shortcut. (Ctrl+Insert does the wrong thing and Ctrl+C does nothing)</p>
  
  <p>I can find my target <code>HWND</code> and persuade it to open the context menu (it responds to <code>WM_RBUTTONDOWN/UP</code> not <code>WM_CONTEXTMENU</code>). From the menu <code>HWND</code> I can even obtain the menu handle via <code>MN_GETHMENU</code> and find the menu item I want. I just don't know the details of how to "choose" the item. It doesn't help that the menu is "modeless", ie. its <code>HWND</code> is not owned, so I don't know which of many hidden <code>TPUtilWindow</code> windows is the real owner - otherwise I could probably just send it a <code>WM_COMMAND</code> and not even pop up the menu, which would be preferable.</p>
  
  <p>Although I am sure it facilitates all sorts of hacks, I would prefer not to inject code into the target process.</p>
  
  <p>Answers accepted in any language.</p>