Microsoft web browser

  • Thread starter Mohammed Abdel-Razzak
  • Start date
M

Mohammed Abdel-Razzak

Dear sirs
I`ve added Microsoft Web browser componet to my project
I`d like to know how can I view a web page in it?

thanks
Mohammed
 
S

Shakir Hussain

Mohammed,

Add this code.

//declaration
private AxSHDocVw.AxWebBrowser mTestBrowser;

//Initialization of browser
this.mTestBrowser = new AxSHDocVw.AxWebBrowser();
((System.ComponentModel.ISupportInitialize)(this.mTestBrowser)).BeginInit();
this.mTestBrowser.OcxState =
((System.Windows.Forms.AxHost.State)(resources.GetObject("mTestBrowse.OcxSta
te")));
((System.ComponentModel.ISupportInitialize)(this.mTestBrowser)).EndInit();

//declare events
this.mTestBrowse.DocumentComplete += new
AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEventHandler(this.mTestBrowser_
DocumentComplete);

///To view webpage
object Zero = 0;
object EmptyString= "";
mTestBrowser.Navigate("http://www.microsoft.com", ref Zero, ref EmptyString,
ref EmptyString, ref EmptyString);

Shak
 
M

Mohammed Abdel-Razzak

Dear Sir
thanks very much for the code you gave me, it was really
so helpful
but actuallty I want to open a web page exists in my
computer not at the web

thanks
Mohammed
 
N

Nicholas Paldino [.NET/C# MVP]

Mohammed,

In this case, change the first parameter of the call to Nagivate2 to the
path of your file, and it will load fine.
 
M

Mohammed Abdel-Razzak

Sir
I`ve written the following code but it didn`t work and
gave me an error

this.axWebBrowser1.Navigate2("c:\\index.html", ref Zero,
ref EmptyString, ref EmptyString, ref EmptyString);

-----Original Message-----
Mohammed,

In this case, change the first parameter of the call to Nagivate2 to the
path of your file, and it will load fine.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

"Mohammed Abdel-Razzak"
 
S

Shakir Hussain

Mohammed you have to pass

..Navigate2("file://c:\napabatch.bat",blah,blah)

to open the file from your computer.

Shak


Mohammed Abdel-Razzak said:
Sir
I`ve written the following code but it didn`t work and
gave me an error

this.axWebBrowser1.Navigate2("c:\\index.html", ref Zero,
ref EmptyString, ref EmptyString, ref EmptyString);

-----Original Message-----
Mohammed,

In this case, change the first parameter of the call to Nagivate2 to the
path of your file, and it will load fine.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

"Mohammed Abdel-Razzak"
 
M

Mohammed Abdel-Razzak

Sir
thanks very much it worked, but with ..Navigate
("file://c:\napabatch.bat",blah,blah)
not with Navigate2("file://c:\napabatch.bat",blah,blah)


thanks very much again
Mohammed


-----Original Message-----
Mohammed you have to pass

..Navigate2("file://c:\napabatch.bat",blah,blah)

to open the file from your computer.

Shak


"Mohammed Abdel-Razzak"
message news:[email protected]...
Sir
I`ve written the following code but it didn`t work and
gave me an error

this.axWebBrowser1.Navigate2("c:\\index.html", ref Zero,
ref EmptyString, ref EmptyString, ref EmptyString);

-----Original Message-----
Mohammed,

In this case, change the first parameter of the
call
to Nagivate2 to the
path of your file, and it will load fine.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

"Mohammed Abdel-Razzak"
message Dear Sir
thanks very much for the code you gave me, it was really
so helpful
but actuallty I want to open a web page exists in my
computer not at the web

thanks
Mohammed


-----Original Message-----
Mohammed,

Add this code.

//declaration
private AxSHDocVw.AxWebBrowser mTestBrowser;

//Initialization of browser
this.mTestBrowser = new AxSHDocVw.AxWebBrowser();
((System.ComponentModel.ISupportInitialize)
(this.mTestBrowser)).BeginInit();
this.mTestBrowser.OcxState =
((System.Windows.Forms.AxHost.State) (resources.GetObject
("mTestBrowse.OcxSta
te")));
((System.ComponentModel.ISupportInitialize)
(this.mTestBrowser)).EndInit();

//declare events
this.mTestBrowse.DocumentComplete += new
AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEventHandler
(this.mTestBrowser_
DocumentComplete);

///To view webpage
object Zero = 0;
object EmptyString= "";
mTestBrowser.Navigate("http://www.microsoft.com", ref
Zero, ref EmptyString,
ref EmptyString, ref EmptyString);

Shak



"Mohammed Abdel-Razzak"
message [email protected]...
Dear sirs
I`ve added Microsoft Web browser componet to my project
I`d like to know how can I view a web page in it?

thanks
Mohammed


.



.


.
 
S

Shakir Hussain

Mohammed.

Navigate - Navigates to a resource identified by a URL or to the file
identified by a full path.

Navigate2 - Navigates the browser to a location that might not be able to be
expressed as a URL, such as a pointer to an item identifier list (PIDL) for
an entity in the Microsoft Windows shell namespace

For your situation, you have to use Navigate. I am glad it worked.

Shak.


Mohammed Abdel-Razzak said:
Sir
thanks very much it worked, but with ..Navigate
("file://c:\napabatch.bat",blah,blah)
not with Navigate2("file://c:\napabatch.bat",blah,blah)


thanks very much again
Mohammed


-----Original Message-----
Mohammed you have to pass

..Navigate2("file://c:\napabatch.bat",blah,blah)

to open the file from your computer.

Shak


"Mohammed Abdel-Razzak"
message news:[email protected]...
Sir
I`ve written the following code but it didn`t work and
gave me an error

this.axWebBrowser1.Navigate2("c:\\index.html", ref Zero,
ref EmptyString, ref EmptyString, ref EmptyString);


-----Original Message-----
Mohammed,

In this case, change the first parameter of the call
to Nagivate2 to the
path of your file, and it will load fine.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

"Mohammed Abdel-Razzak"
message Dear Sir
thanks very much for the code you gave me, it was really
so helpful
but actuallty I want to open a web page exists in my
computer not at the web

thanks
Mohammed


-----Original Message-----
Mohammed,

Add this code.

//declaration
private AxSHDocVw.AxWebBrowser mTestBrowser;

//Initialization of browser
this.mTestBrowser = new AxSHDocVw.AxWebBrowser();
((System.ComponentModel.ISupportInitialize)
(this.mTestBrowser)).BeginInit();
this.mTestBrowser.OcxState =
((System.Windows.Forms.AxHost.State)
(resources.GetObject
("mTestBrowse.OcxSta
te")));
((System.ComponentModel.ISupportInitialize)
(this.mTestBrowser)).EndInit();

//declare events
this.mTestBrowse.DocumentComplete += new

AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEventHandler
(this.mTestBrowser_
DocumentComplete);

///To view webpage
object Zero = 0;
object EmptyString= "";
mTestBrowser.Navigate("http://www.microsoft.com", ref
Zero, ref EmptyString,
ref EmptyString, ref EmptyString);

Shak



"Mohammed Abdel-Razzak"
message [email protected]...
Dear sirs
I`ve added Microsoft Web browser componet to my
project
I`d like to know how can I view a web page in it?

thanks
Mohammed


.



.


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

tree view 1
Discussion group 1
restoring database using SQLDMO 1
MsComm32.ocx 5
Global variable 3
MSCOMM32.OCX exception 1
data grid Event 1
SqlCommand 3

Top