473,657 Members | 2,492 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WebBrowser control : need help controlling browser control from within VC++ .NET 2003 program


I added the WebBrowser component to my toolbox,
then placed one on a form with other .NET components.
This much seems to have worked, but I do not understand
how to control the sucker from within my application.

Specifically, what sort of syntax is involved to get the
various interfaces (IHTMLWindow, IHTMLDocument3, etc)
in the internal objects and call functions in them?

What has worked is this:

A: the framework put the following in the form class:
private: AxInterop::SHDo cVw::AxWebBrows er* browser;

B: the framework put the following in the InitializeCompo nent()
part of the form class:
this->browser = new AxInterop::SHDo cVw::AxWebBrows er();
(__try_cast<Sys tem::ComponentM odel::ISupportI nitialize*>(thi s->browser))->BeginInit();
and elsewhere
this->browser->Enabled = true;
this->browser->Location = System::Drawing ::Point(400, 24);
this->browser->OcxState = (__try_cast<Sys tem::Windows::F orms::AxHost::S tate * >(resources->GetObject(S"br owser.OcxState" )));
this->browser->Size = System::Drawing ::Size(360, 176);
this->browser->TabIndex = 3;

including this because I added one event handler:
this->browser->DocumentComple te += new AxInterop::SHDo cVw::DWebBrowse rEvents2_Docume ntCompleteEvent Handler(this,
web_browser_eve nt_document_com plete);
So, here we are in an event handler, and no matter what I try
off the top of my head, it doesn't work. I can call some of
the immediately available methods like the one shown below,
but how to deal with the document variable is what I don't get.
How do I get IHTMLWindow3 and IHTMLDocument3 and such
in order to get at the document and its html-text and such?
And how do I find out what I CAN get, in general? Is there
some way to make the framework show what can be done,
like with normal methods.

Thanks in advance:

private: System::Void web_browser_eve nt_document_com plete (System::Object * sender,
AxInterop::SHDo cVw::DWebBrowse rEvents2_Docume ntCompleteEvent * e) {

System::Object* document = browser->get_Document() ;
int a = 0;
}


Nov 17 '05 #1
0 1982

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

Similar topics

0
1400
by: Robin Tucker | last post by:
Hi people, Is it possible for me to handle events raised by an object which is embeded in a web browser control, from my VB.NET code? I am able to gain access to the object itself through the browser object model and have successfully used IPersistStorage to get/set the object in the browser control from VB.NET. As the object is "in place active" in the browser (I'm using the browser as an OLE container), I would like to be notified of...
4
2876
by: Randy | last post by:
Hi, ok, I found a way to connect to a running instance of an (external) Internet Explorer and access - for example - the html source. That works fine! But now I have running application with an embedded IE webBrowser Control. Is there a possibility for my application to access the webBrowser control in the other application, too? Thanks in advance, Randy
0
3459
by: Jim Hubbard | last post by:
How would I implement the IDispatch interface to handle the following in VB.Net <BEGIN> Controlling Download and Execution The WebBrowser Control gives you control over what it downloads, displays, and executes. To gain this control, you need to implement your host's IDispatch so it handles DISPID_AMBIENT_DLCONTROL. When the WebBrowser Control is instantiated, it will call your IDispatch::Invoke with this ID. Set pvarResult to a...
4
1464
by: Jim | last post by:
Dear Santa, While it's true that I haven't been perfect this year, it's definitely an improvement over previous years. All cats still have their own fur, no hidden cat fur in this year's Thanksgiving green bean casserole and not even one kid in the neighborhood has lost a toe this year! With these things in mind, I'd like to ask for knowledge this Christmas. Specifically, for knowledge about extending the webbrowser control in VB.Net...
9
25832
by: Jason Boardman | last post by:
Can anyone tell me how I can write HTML to a WebBrowser control in Visual Basic 6? I want to display HTML in the browser that is generated from within my VB program (as opposed to loading it from a file or URL). Is this possible? Jason
12
6359
by: Alex Clark | last post by:
Greetings, (.NET 2.0, WinXP Pro/Server 2003, IE6 with latest service packs). I've decided to take advantage of the layout characteristics of HTML documents to simplify my printing tasks, but of course it's thrown up a whole host of new issues... I'm generating a multi page printable document in HTML from my app, and displaying it in a WebBrowser control. I've looked into using some CSS
11
2817
by: Anil Gupte | last post by:
....and how do I insert one into my form? I used in VB 6.0 last, but cannot figure out where it is in .Net Thanx, -- Anil Gupte www.keeninc.net www.icinema.com
4
4860
by: David A. Beck | last post by:
I need to enter data on a web page. I have been able to navigate using the VB.NET WebBrowser control and see the contents of each page. What I need to do now is to fill in the controls on the page with text and send an <enter> key. If WebBrowser can't do this, does anyone know of a different managed control that can do this? Dab
3
1873
by: Peter Oliphant | last post by:
It's not necessary, but it would be nice if there was a way I could easily create something like a 'web browser form' or a 'display web page form' as forms in my application (in a Panel would be even better!). Something that allows browsing the internet within the window, or possibly just display a web page that I choose (as the application author in code) to show without the ability to browse. The later ability would allow me to change,...
0
8403
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
8833
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...
0
8737
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
8509
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
7345
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
6174
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
5636
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();...
2
1967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1730
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.