473,772 Members | 3,672 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Linderry
1 New Member
Hello,

I went through a long processs to clear the concept of overriding the IDocHostUIHandl er 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.Docum ent can not be casted into a iCustomDoc. If I put MyBrowser.Docum ent.DomDocument , it passes through but I get Variant errors after the program starts running.

Help would be appreciated.

Alain
Feb 24 '12 #1
0 1096

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

Similar topics

4
10712
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 am familiar with HTML Applications (HTA), but how are features like the right-click context sensitive menu and selection diabled in VS.NET's Start Page? If I attempt to make a WebBrowser control navigate to an HTA file, it brings up a dialog...
7
7539
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 for the WebBrowser Control from Visual Basic .NET. This code worked in VB.Net 2003 but not in VB.Net 2005. Specifically this doesn't work... (all code is from article)
8
3419
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
2339
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
3014
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 String = IM.GetConvertedText(decode) get the text in the im, which works perfectly fine, ive tested it. all my variables have a value
1
4283
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 WebBrowser control.*** So, I think making a delegate to invoke the function from the proper thread will solve the problem. But, I just want to know: Why is the above exception happening? Where is the cast?
6
7530
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 0x1a1530' is disconnected. Releasing the interfaces from the current context (context 0x1a13c0).This may cause corruption or data loss. To avoid this problem, please ensure that all contexts/ apartments stay alive until the applicationis completely...
1
2837
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 doesn't meet all my demands, because I need to custom many behaviors of the control. So I thought I should use it through ActiveXWrapper directly. So I use makepy to make the typelib of "Microsoft Internet Controls" and "Microsoft HTML Object...
0
1865
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 (MapInfo professional) from our app using interop services and do some reparenting etc to make it look like our app. We also register our own application as a COM server and let MapInfo professional register a callback so MapInfo can communicate...
11
2217
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: //////////////////////////////////////////////// Public Sub DisplayHyperlinks(ByVal sender As Object, ByVal e As System.Windows.Forms.HtmlElementEventArgs)
0
9620
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
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
10104
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
10038
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
6715
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();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
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.