Get ActiveX Object properties
In short: I have a VB6 form with ActiveX control that contains buttons, and I would like to create automat开发者_StackOverflow中文版ic tool that can click this buttons using C#. I tried to use reflection for this issue, but I cannot access the form. The general direction I was suggested was to use window API to access the form, but it seem very "expensive" solution.
Does anyone familiar with this subject? Thank you
Can you use AutomationElement from .net?
To test this:
download UiSpy.zip link taken from this question
Get the form open, activate the hover mode. If you "see" the button it should be easy to use ] AutomationElement to actually send a click to it.
How about sending/hooking window messages (e.g. sending WM_MOUSEDOWN or WM_MOUSEMOVE)? Short/simplified example can be found here.
If your goal is to automate the UI for testing, I would suggest TestComplete from SmartBear Software which can directly access your VB6 forms, controls and properties. They're basically hooking into the process and accessing the "Forms" object and "Screen" object to get access to the loaded forms.
精彩评论