Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening a Web Page

Status
Not open for further replies.

ChrisAgius

Programmer
Sep 27, 2000
51
MT
Any Idea on how to open a web page in a default browser. or internet explorer
 
Hi Chris,

DECLARE INTEGER ShellExecute IN SHELL32 INTEGER hwnd, STRING cOP, STRING cFile,;
STRING cParams, STRING cStartDir, INTEGER nShowCmd
DECLARE INTEGER GetDesktopWindow IN User32

lnWhnd = GetDesktopWindow()
lnResult = ShellExecute(lnWhnd, 'OPEN', ' '', '', 5) Jon Hawkins
jonscott8@yahoo.com

The World Is Headed For Mutiny,
When All We Want Is Unity. - Creed
 
APPENDUM

IF lnResult < 0x32
MESSAGEBOX('Unable to Open Web Page',0,'Error')
ENDIF Jon Hawkins
jonscott8@yahoo.com

The World Is Headed For Mutiny,
When All We Want Is Unity. - Creed
 
Wouldn't COM be the easier way to do this?

Code:
oWeb = CreateObject(&quot;InternetExplorer.Application&quot;)
oWeb.Visible = .T.
oWeb.Navigate(&quot;[URL unfurl="true"]www.foxdev.com&quot;)[/URL]

Robert Bradley

 
The advantage of using the windows shell is that you don't have to worry about the installed browser (Internet Explorer or Netscape)
Diederik Vermeeren
verm1864@exact.nl
 
True...I entirely agree, but:

* the OP mentioned IE as an acceptable choice

* for better or worse, just about everyone running Windows has IE installed (though not necessarily the default), thanks to A) Microsoft's efforts to make our Windows experience better, or B) Microsoft's attempt to affect the U.S. Electoral College voting.

Robert Bradley

 
Wouldn't COM be the easier way to do this?

Of course it would. But as Diederik mentioned, it's best to let the OS delegate what browser to use, in the event IE isnt installed.

FWIW, I thought of posting the following:

WshShell = CreateObject(&quot;WScript.Shell&quot;)
WshShell.Run(&quot;Iexplore.exe
But that not only creates a dependancy on IE, but WSH as well. So in this case, I felt the API was more reliable.

oWeb.Navigate(&quot;www.foxdev.com&quot;)

Yet another shameless plug. :-V Jon Hawkins
jonscott8@yahoo.com

The World Is Headed For Mutiny,
When All We Want Is Unity. - Creed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top