By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,640 Members | 1,331 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,640 IT Pros & Developers. It's quick & easy.

Accessing the MSHTML object in IE

P: n/a
How can I access the MSHTML object in Internet Explorer, from my app?
I don't want to use the IE Control and put it in my app. I want to be
able to do things with the opened document in the allready started IE.

Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi,

Add a reference to Microsoft HTML object library in the com tab.

Private Sub AxWebBrowser1_DownloadComplete(ByVal sender As Object, ByVal e
As System.EventArgs) Handles AxWebBrowser1.DownloadComplete
Dim doc As mshtml.HTMLDocumentClass

doc = CType(AxWebBrowser1.Document, mshtml.HTMLDocumentClass)

RichTextBox1.Text = doc.documentElement.innerHTML
End Sub

Ken
------------------
"Nikolay Petrov" <jo******@mail.bg> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
How can I access the MSHTML object in Internet Explorer, from my app?
I don't want to use the IE Control and put it in my app. I want to be
able to do things with the opened document in the allready started IE.
Nov 21 '05 #2

P: n/a
depending upon what you need to do with the underlying HTML, you can
also use one of the other document classes...

a friendly warning: these COM classes *change* the underlying source in
subtle ways (capitalizing, adding spaces, trimming trailing ";"
characters in styles, etc.

here's another code snippet

'get the IHTMLDocument2 object
Dim htmldoc2 As mshtml.IHTMLDocument2
htmldoc2 = CType(WebBrowser1.Document.DomDocument,
mshtml.IHTMLDocument2)

'get the IHTMLTextRange object
Dim textrange As mshtml.IHTMLTxtRange =
CType(htmldoc2.selection.createRange, mshtml.IHTMLTxtRange)

Nov 21 '05 #3

P: n/a
Nikolay,

AFAIK will this part not go.
I want to be
able to do things with the opened document in the allready started IE.


However you can open IE using the shdocvw and instance from that
InterenetExplorer instead of axwebbrowser. Be aware that you get than a much
more limited amount of methods, which is not documentated.

'Add from Project menu a reference from
'COM Microsoft Internet Controls
Public Class testIE
Public Shared Sub main()
Dim a As New SHDocVw.InternetExplorer
a.Visible = True
a.Navigate2("http://msdn.microsoft.com/")
End Sub
End Class

You can than use code as Ken and Stand sure showed.

I hope this helps, although it is not the answer you expected.

Cor
Nov 21 '05 #4

P: n/a
I need an access to the default IE browser, which every user can start,
not one created using axwebbrowser or shdocvw.
I guess my prog should be an plugin for IE, but I don't have idea how
to write one.

Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.