473,320 Members | 1,883 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

While overriding the HostUiHandler, how to cast WebBrowser.Document into iCustomDoc

Linderry
Hello,

I went through a long processs to clear the concept of overriding the IDocHostUIHandler of the WebBrowser in Visual Studio 2010.

I am now stucked on the last miles. I do not fin how to cast my WebBrowser instance into a IcustomDoc.

Here is my SetUiHandler method :

Expand|Select|Wrap|Line Numbers
  1.  
  2.    Private Sub SetUIHandler()
  3.  
  4.         Dim cDoc As ICustomDoc = DirectCast(Me.MyBrowser.Document, ICustomDoc)
  5.         cDoc.SetUIHandler(DirectCast(Me, IDocHostUIHandler))
  6.  
  7.         ' *** Make sure you wait for a readystate of DocumentComplete here ***
  8.         While MyBrowser.ReadyState <> WebBrowserReadyState.Complete
  9.             Application.DoEvents()
  10.         End While
  11.     End Sub
  12.  
The bold line is where I receive an alert that MyBrowser.Document can not be casted into a iCustomDoc. If I put MyBrowser.Document.DomDocument, it passes through but I get Variant errors after the program starts running.

Help would be appreciated.

Alain
Feb 24 '12 #1
0 1084

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Noah Coad [MVP .NET/C#] | last post by:
How does one gain access to the WebBrowser (SHDocVw) control to the extent of the one used in VS.NET Start Page? I'm familiar with using the control directly, I've written a tutorial on it, and...
7
by: Doe | last post by:
I've been trying this for months. Doesn't work. I've used the code in this article, http://support.microsoft.com/kb/311288/en-us, HOW TO: Invoke the Find, View Source, and Options Dialog Boxes...
8
by: Prosperz | last post by:
Hi, I would like to make thumbnails of web page by capture content of a WebBrowser. By example, capture http://www.google.com. I used WebBrowser control with Framework 2.0. I try this : ...
0
by: df | last post by:
How can I save all files which the htm page is using,such as all local images files,as IE does?
1
by: iwdu15 | last post by:
ok, this is driving me insane, plz someone help. im attempting to add text to a webbrowser document text by doing as follows, IM is an Instant Message object in the AIM SDK, the line Dim str As...
1
by: Zytan | last post by:
if (webBrowserControl.Document == null) is throwing an InvalidCastException. PLEASE NOTE: ***The function being called is being called from a thread OTHER THAN than the one that created the...
6
by: Zytan | last post by:
Make a WebBrowser control, and make a bunch of timers / threads that continually call WebBrowser.Document.Write. Eventually, this happens: DisconnectedContext was detected Message: Context...
1
by: zdp | last post by:
Hi, all, My project is based on wxPython, and I need an IE control (i.e. WebBrowser ActiveX control). Although the wxPython implements a wrapped version (wx.lib.iewin.IEHtmlWindow), but it...
0
by: jan.loucka | last post by:
We're running Windows Forms application written in .NET 2.0 (c#). The application is single threaded app - it starts without any form (Application.run()). After that we start another application...
11
by: kimiraikkonen | last post by:
Hi there, I needed to use MouseOver event on Webbrowser which is NOT provided by webbrowser control natively(what a disappointment), so i decided to go with another route to simulate this like: ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.