I need to right click on another application, gets it context menu (that was opened after the right click), and than select an item from it.
I can use the postMessage with the other application handle, and as a results the requested context menu did appear, but I have no idea of how to select from it.
public const int WM_RBUTTONDOWN = 0x0204;
public const int WM_RBUTTONUP = 0x0205;
[System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SendMessage", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
public static extern void SendMessage(IntPtr hWnd, int msg, int wParam, int lParam);
[System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "PostMessage", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
public static extern void PostMessage(IntPtr hWnd, int msg, int wParam, int lParam);
Point p = Cursor.Position;
PostMessage((IntPtr)123456, WM_RBUTTONDOWN, 0, 0);
PostMessage((IntPtr)123456, WM_RBUTTONUP, 0, 0);
what should I do next (now the context menu is open)?
thanks, Tomer.