473,946 Members | 10,704 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB.Net - Can't get type for "MSHTML.HTMLDoc umentsEvents2"

I have an VB.Net desktop application where I am hosting a WebBrowser.

I need to interact with the events in the browser.
I encountered the normal problem of, after adding events the normal click
on the browser didn't work (in particular you can't enter text into
textareas).

I found the Microsoft KB article 311284 - "How to handle document evetns
in VB.Net" - and implemented the code.

However when I run the application I get the following error:

--------------Error Message------------------------------------------
Doc Complete Error: Could not load type mshtml.HTMLDocu mentEvents2 from
assembly WindowsApplicat ion1, Version=1.0.215 5.37390, Culture=neutral ,
PublicKeyToken= null.
at System.Type.Get Type(String typeName, Boolean throwOnError, Boolean
ignoreCase)
at WindowsApplicat ion1.IEEvents.D ocumentComplete (Object pDisp, Object&
URL) in D:\WinXP\jobs\W ebBrowser\HTMEv ents\VB\IEEvent s.vb:line 204
--------------------------------------------------------------------
where lines 203-204 are:
--------------------------------------------------------------------
203: Dim tt As System.Type
204: tt = System.Type.Get Type("mshtml.HT MLDocumentEvent s2", True, True)
--------------------------------------------------------------------

Why can't the application find 'mshtml.HTMLdoc umentevents2'?
And what do I need to change / add to the application
(like building an interop for mshtml?).
Any help greatly appreciated.

Mike
Nov 25 '05 #1
5 4389
Miktro,

Which webbroswer are you using the VB2005 or VB2003 version.

They are complete different in use while the documentation on MSDN is still
all VB2005

Cor
Nov 26 '05 #2
still all vb2003
Nov 26 '05 #3
"Cor Ligthert [MVP]" <no************ @planet.nl> wrote in
news:eW******** ******@TK2MSFTN GP11.phx.gbl:
Miktro,

Which webbroswer are you using the VB2005 or VB2003 version.

They are complete different in use while the documentation on MSDN is
still all VB2005

Cor


I'm using VB2003 - and had the same problem earlier with vb2002.
I have done many hours of google searching and found a few solutions to
thsi problem (mainly in C#) that use the same approach of using a
delegate to duplicate the event handling.
I've also found a few messages claiming to have usccessfully used the MS
KB VB.Net code.

Anyway - the question still is:

203: Dim tt As System.Type
204: tt = System.Type.Get Type("mshtml.HT MLDocumentEvent s2", True, True)
--------------------------------------------------------------------

Why can't the application find 'mshtml.HTMLdoc umentevents2'?
And what do I need to change / add to the application?
Mike
Nov 26 '05 #4
Miktro,

In my opinion is it if you use MSHTML inside the browser that you should use
the browser events

However to set text in the browser you have to set this.
\\\
Private Sub AxWebBrowser1_N avigateComplete 2(ByVal sender As System.Object,
ByVal e As _
AxSHDocVw.DWebB rowserEvents2_N avigateComplete 2Event) Handles _
AxWebBrowser1.N avigateComplete 2
oDocument = DirectCast(Dire ctCast(e.pDisp, SHDocVw.WebBrow ser).Document, _
mshtml.IHTMLDoc ument2)
DirectCast(Dire ctCast(e.pDisp, SHDocVw.WebBrow ser).Document, _
mshtml.IHTMLDoc ument2).designM ode = "On"
End Sub
///

I hope this helps,

Cor
Nov 26 '05 #5
"Cor Ligthert [MVP]" <no************ @planet.nl> wrote in
news:ur******** *****@TK2MSFTNG P10.phx.gbl:
Miktro,

In my opinion is it if you use MSHTML inside the browser that you
should use the browser events

However to set text in the browser you have to set this.
\\\
Private Sub AxWebBrowser1_N avigateComplete 2(ByVal sender As
System.Object, ByVal e As _
AxSHDocVw.DWebB rowserEvents2_N avigateComplete 2Event) Handles _
AxWebBrowser1.N avigateComplete 2
oDocument = DirectCast(Dire ctCast(e.pDisp,
SHDocVw.WebBrow ser).Document, _ mshtml.IHTMLDoc ument2)
DirectCast(Dire ctCast(e.pDisp, SHDocVw.WebBrow ser).Document, _
mshtml.IHTMLDoc ument2).designM ode = "On"
End Sub
///

I hope this helps,

Cor


Thanks Cor - I'm not sure if this helps as I can enter text perfectly OK
- as long as I don't intercept events on the document directly.
But I'll keep it in mind if I hit any later problems.

I am intercepting the mshtml.htmldocu mentevents2 events (the whole
pointof the excercise is ot get hold of the onclick event etc.)
and I am using the microsoft example code to construct an additional
delegate to re-cast and handle the interface - now SUCCESSFUL!

I found the GUID I need as a string by searching
\HKEY_CLASSES_R OOT\interface for the string "htmldocumentev ents2"
but I would like to know if there is a way of doing this from within
vb.net - without hardcoding the guid into the code.

Anyway - everything seems to be working perfectly now.
My web browser behaves as normal - and I can intercept all the events
with VB.Net code without changing the browser behaviour.

Nov 26 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
3743
by: mike | last post by:
regards: I use Jtidy (api) to translate a HTML file into a "XHTML file". But The "XHTML file" cannot be identified by nokia 6600. Do I miss something important? Or this is Jtidy's weakness or bug? Can someone excellent to tell me the reason. best wishes
2
4240
by: Mr.Clean | last post by:
If I have an Input of type image, it is not listed in the Forms elements when walking to DOM using MSHTML. Is this expected behaviour and how would I get the image input to submit the form NOT using document.form.submit?
5
2835
by: Robin Tucker | last post by:
Hiya, I'm using mshtml and the web browser control to embed an OLE object in my ..NET application. What I want to do is get a reference to the "object" embedded therein: The HTML looks something like this: <html>
0
1300
by: Brett | last post by:
I get the following in my watch window on the strType var for the second to last line: strType error: identifier 'strType' out of scope string strName; string strId; string strvalue; string strType; try
0
10189
by: mammucion | last post by:
Trying to automate processing 80,000 data sets through 15 web pages. Application URL creates a new IE instance in which runs first a login form and then runs the rest of the pages in the new window. I can connect to a running Excel instance and obtain information from the Excel DOM. I cannot do the same with Internet Explorer. However, I can successfully create an new IE instance and manipulate it. Using an application that has its own...
3
2616
by: John | last post by:
Does anyone know how to simulate the right click "Save Target As" using MSHTML? I find that I can navigate through the LinksCollection on any given page but often these links are links to files (*.doc, *.xls etc). If I follow the link, it will open the document, but I am interested in saving it. Any ideas?
0
1549
by: GHS | last post by:
I'm writing code to parse a specific website and decided to use MSHTML to help (instead of regular expressions). The parsing code is complete - looks very nice if I say so myself. :-) The problem I have is setting up the doc itself. Here is a code snippet of where the problem shows up: FileStream file = new FileStream("c:\\day.html", FileMode.OpenOrCreate, FileAccess.Read); StreamReader sr = new StreamReader(file); string html =...
20
2035
by: Prisoner at War | last post by:
Hi, People, Is it possible to have an "empty" or "dummy" <a href***without*** the browser jumping back up the page?? I have a hyperlink that doesn't point to another document, but is used to call forth a modal window onClick (or is there another way, without text or image links, of calling forth JavaScript on user activity??). I would like to spare my visitors the inconvenience and visually jarring effect of getting thrown back up to...
24
8286
by: Jeremy J Starcher | last post by:
While reading c.l.j, I've noticed that some people prefer and indeed even recommend the use of "window.alert()" over "alert()". I can't find any technical reason to make this distinction, and seems to have a (tiny) amount overhead since window itself points to the global object, hence, a circular reference. (From everything I am reading, window is just a REFERENCE back to the global object, as opposed to a separate object.)
0
9976
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
11554
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
11328
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
9875
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
8241
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
7406
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
4930
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
2
4526
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3528
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.