473,787 Members | 2,989 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 1097

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
3420
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
9655
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
10169
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
10110
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
9964
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
8993
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...
0
5398
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
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4067
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
2894
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.