473,795 Members | 3,457 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing the MSHTML object in IE

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
4 1906
Hi,

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

Private Sub AxWebBrowser1_D ownloadComplete (ByVal sender As Object, ByVal e
As System.EventArg s) Handles AxWebBrowser1.D ownloadComplete
Dim doc As mshtml.HTMLDocu mentClass

doc = CType(AxWebBrow ser1.Document, mshtml.HTMLDocu mentClass)

RichTextBox1.Te xt = doc.documentEle ment.innerHTML
End Sub

Ken
------------------
"Nikolay Petrov" <jo******@mail. bg> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.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
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.IHTMLDoc ument2
htmldoc2 = CType(WebBrowse r1.Document.Dom Document,
mshtml.IHTMLDoc ument2)

'get the IHTMLTextRange object
Dim textrange As mshtml.IHTMLTxt Range =
CType(htmldoc2. selection.creat eRange, mshtml.IHTMLTxt Range)

Nov 21 '05 #3
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
InterenetExplor er 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.Interne tExplorer
a.Visible = True
a.Navigate2("ht tp://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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
7770
by: Dean Hallman | last post by:
I need to ensure client machine has Microsoft.mshtml installed in the GAC. And if not, deploy it. My app is a Browser Helper Object and depends on mshtml. Initially, I thought I could take care of deploying mshtml within my install ..msi (VS.NET setup/deploy project). But if I simply add mshtml to the GAC from my install, the install fails near the end with the error:
13
7232
by: Tom Bean | last post by:
I developed a C# application to automate input to elements of a web page displayed in an AxWebBrowser control. The app calls GetEnumerator() on the HTMLDocument's HTMLElementCollection (i.e. HTMLDocument.all) to walk elements of the document. This works perfectly on my development system with both Debug and Release builds, however, when I deploy the app to a client system running Windows XP Professional, it doesn't work. I added...
4
3315
by: Lars-Erik Aabech | last post by:
Hi! I've been walking in extacy since reading the article about test automation with IE in the latest MSDN mag. (http://msdn.microsoft.com/msdnmag/issues/05/10/TestRun/default.aspx) After a while, I had to find an issue I couldn't solve. (Of course) If an ASP.NET page uses the smartnav option, the document you get from IE only contains the viewstate input etc, the scripts and an IFrame.
3
4273
by: John Williams | last post by:
I have a HTML page consisting of several tables at the top level of the DOM, interpersed with other HTML tags. For example: HTML BODY -- SCRIPT -- SCRIPT -- #comment -- SCRIPT -- A
2
3292
by: J Williams | last post by:
I'm using the WebBrowser control and mshtml library to modify the HTML in a web page. E.g. the code below is meant to change all .txt links to .zip, but doesn't because mAnchorElement is just a copy of mElement and doesn't reference mElement and any changes I make to it affect the copy and not mElement. Private Sub Web1_DocumentComplete(ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent) Handles...
0
2238
by: Atara | last post by:
Our application was build with VS 2003. I have tried to run it on a computer with .Net 2.0 (but without .Net 1.1 , as it should be used) and I got the following error - System.InvalidCastException: Unable to cast COM object of type 'mshtml.HTMLBodyClass' to class type ''. COM components that enter the CLR and do not support IProvideClassInfo or that do not have any interop assembly registered will be wrapped in the __ComObject type....
6
2606
by: Dominique | last post by:
Hi all, I'm using .NET v1.1 and the scenario I have is as follows... I have IE as an ActiveX control embedded in may C# App. I generate a HTML file dynamically and within the HTML file I embed a Flash, powerpoint presentation or movie file similar to ... <object id="globalnav-object" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"...
11
2365
by: Lucky | last post by:
hi guys, i need to parse html data that i've got from "Inet" object in vb6. now i want to prase the html data. here i got 2 options. one is MSXML and other is MSHTML. i tried both of them but i didnt get anything out of them. MSXML doesnt works with some keywords and consider some letters as operator so i cant go with MSXML. i tried MSHTML but it doesnt provide any way to parse the HTML data you got from other source. there is a...
0
1400
by: nara | last post by:
Hello I have a problem with this code : It throw the "System.InvalidCastException" exception. I use mshtml.dll. SomeOne could explain me why ? For advance thanks...
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10214
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10164
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10001
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9042
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6780
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.