Microsoft web browser

  • Thread starter Thread starter Mohammed Abdel-Razzak
  • Start date 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
 
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
 
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
 
Mohammed,

In this case, change the first parameter of the call to Nagivate2 to the
path of your file, and it will load fine.
 
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"
 
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"
 
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


.



.


.
 
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


.



.


.
 
Back
Top