views:

459

answers:

2

I have an Internet Explorer browser embedded in a Windows forms application and do not have the ability to modify the source code of this form. However, I have gotten a handle to the IE window and can perform various SendInput functions. If I click on a control how can I tell if it was a TextBox, and then how do I send characters to that TextBox?

I need answers that use a handle to the IE window I have obtained already for my other functionality. The answer I need must involve a handle to the IE window.

A: 

You can't. The controls on IExplore are not windows controls anymore - they are custom entities rendered by IExplore that merely look similar to actual windows controls.

The only way to interact with the controls on a web page is by accessing the internet explorer windows' activeX control, ask it for IID_IWebBrowser2, and from that point navigate the document object model namespace.

If by " do not have the ability to modify the source code of this form" you mean your code is running in an entirely different process, then you have a very very large problem. If you're in the same process theres a good chance that the WinForms has an API you could use to coerce access to any activex controls its hosting.

Given your suboptimal choice of language for this kind of dev - c# - I can give no advice on how easy or possible interop with activex controls is going to be.

Chris Becke
A: 

hi i am facing the same problem so if you got it please tell me my email is [email protected] best regards