I have a unique challenge. I've been tasked with manipulating a third party application's controls from my own application and I'm restricted to .Net 3.5. I'm able to write text to a rich text box from the clipboard and click a button so far (thank you Spy++):
// paste text into Rich Text Box
IntPtr hwndChild = FindWindowEx((IntPtr)handle, IntPtr.Zero, "WindowsForms10.RichEdit20W.app.0.378734a", null);
SendMessage(hwndChild, Msgs.WM_PASTE, 0, IntPtr.Zero);
// click OK button
hwndChild = FindWindowEx((IntPtr)handle, IntPtr.Zero, "WindowsForms10.BUTTON.app.0.378734a", null);
SendMessage(hwndChild, Msgs.BM_CLICK, 0, IntPtr.Zero);
Now I'm trying to access a combobox in the other app to compare it's datasource contents with a value read from elsewhere, and if that value matches one in the combobox, then select that value in the other app's combox. My application is in C#.
I'm able to get the handle of the combobox in the other app using the user32.dll method FindWindowEx() like this:
hwndChild = FindWindowEx((IntPtr)handle, IntPtr.Zero, "WindowsForms10.STATIC.app.0.378734a", null);
I used Spy++ to find the combobox's class name, but don't know what to do next. I tried this:
NativeMessage lpMsg = new NativeMessage();
PeekMessage(out lpMsg, hwndChild, 0, 0, 0x0000); // set wRemoveMsg to 0x0000
but lpMsg is empty after the call. That was a wild-ass guess anyway. Any ideas?