I'm currently building an application that will interact with another application via sending text to textbox controls, clicking buttons, etc (general Windows Automation stuff). I am building this app with C# 4.0 framework.
I'm struggling setting the text of a control that has a type of AfxOleControl42.
I verified I grab the proper control (handle id) via Spy++, because when I log messages in Spy++, when I send text to the particular textbox control (of type AfxOleControl42), it tells me that I'm keydowning and keyupping in the expected
However, when I try to interact with this textbox control programmatically, I am unable to
I've tried the following methods:
SendMessage(int, WM_SETTEXT, 0, STRING_TO_SEND)
SendMessage(int, WM_KEYDOWN (and then WM_KEYUP), 0, STRING_TO_SEND)
Used AutomationElement object...((ValuePattern)valuePattern).SetValue(value);
System.Windows.Forms.SendKeys.Send() and .SendDelay()
When using AutomationElements, and I try to set focus, I get an exception "Target element cannot receive focus".
Has anyone had issues with this type of control before? I have no idea why the developer didn't just use a TextBox control, instead of AfxOleControl42, but it seems more like a Panel than a TextBox...
**Edit: This is on a Windows 7 machine***
Edited bytimclaasonMonday, October 14, 2013 3:39 PM