Use mshtml.HTMLDocument to control a browser window
Posted on 2007-10-06
I have an mshtml.HTMLDocument that I fetched from an Internet Server_Explorer window, as in
mshtml.HTMLDocument document = null;
uint WM_HTML_GETOBJECT = RegisterWindowMessage("WM_HTML_GETOBJECT");
SendMessageTimeout(hWnd, WM_HTML_GETOBJECT, IntPtr.Zero, IntPtr.Zero, SendMessageTimeoutFlags.SMTO_NOTIMEOUTIFNOTHUNG, 1000, out lngRes);
document = (mshtml.HTMLDocument) ObjectFromLresult(
lngRes, typeof(mshtml.HTMLDocument).GUID, IntPtr.Zero);
I ordinarily fill in the form by hand and click the Go button. I want to change that to an automated process, which is why I have this question.
The HTML in the document contains
<INPUT class=oFF size=15 value=ABC name=p>
<INPUT class=oFF type=submit value=Go>
The INPUT field named p contains the value I would like to send to the host and the INPUT field named Go is the button I would like to push.
I'm assuming that mshtml.HTMLDocument will allow me to do this.
Am I right?
If I'm right, how do I do that?
If I'm wrong, how else should I approach the problem?