Quantcast
Viewing all articles
Browse latest Browse all 585

AfxOleControl42 Set Text

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 handle id.

However, when I try to interact with this textbox control programmatically, I am unable to

I've tried the following methods:

  1. SendMessage(int, WM_SETTEXT, 0, STRING_TO_SEND)
  2. SendMessage(int, WM_KEYDOWN (and then WM_KEYUP), 0, STRING_TO_SEND)
  3. PostMessage()
  4. Clipboard paste
  5. Used AutomationElement object...((ValuePattern)valuePattern).SetValue(value);
  6. 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***



Viewing all articles
Browse latest Browse all 585

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>