473,387 Members | 1,486 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,387 software developers and data experts.

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::SHDocVw::AxWebBrowser* browser;

B: the framework put the following in the InitializeComponent()
part of the form class:
this->browser = new AxInterop::SHDocVw::AxWebBrowser();
(__try_cast<System::ComponentModel::ISupportInitia lize*>(this->browser))->BeginInit();
and elsewhere
this->browser->Enabled = true;
this->browser->Location = System::Drawing::Point(400, 24);
this->browser->OcxState = (__try_cast<System::Windows::Forms::AxHost::State * >(resources->GetObject(S"browser.OcxState")));
this->browser->Size = System::Drawing::Size(360, 176);
this->browser->TabIndex = 3;

including this because I added one event handler:
this->browser->DocumentComplete += new AxInterop::SHDocVw::DWebBrowserEvents2_DocumentCom pleteEventHandler(this,
web_browser_event_document_complete);
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_event_document_complete (System::Object* sender,
AxInterop::SHDocVw::DWebBrowserEvents2_DocumentCom pleteEvent* e) {

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


Nov 17 '05 #1
0 1965

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

Similar topics

0
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...
4
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...
0
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,...
4
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...
9
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...
12
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...
11
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
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...
3
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...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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,...
0
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...

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.