Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Articles
Search: 

Starting the default Web Browser from VFP
Gérald Santerre, June 22, 1997
To start the default web browser and load a location(web page) you can use the Win API function ShellExecute().
Summary
To start the default web browser and load a location(web page) you can use the Win API function ShellExecute().
Description
This function can be used as an alternative of the ! or run command. This could be a nice add to your about box! (if you have a web site)
*You can look at the win32api help form more details

 *You can place this code on a button click event

 * This code was used to start the default browser and to navigate
 * to the URL placed in var "MonURL"

 *If i place a URL to an 'HTM' or an 'HTML' file windows start the default
 *browser associate with this extention.
 *It works like a double-click on a file in explorer

 MonURL="http://www.total.net/~gersan/index.htm" 

 * or you can place a 'Mail' URL to start the
 * default Email program (ex. MonURL = "mailto:gersan@total.net")

 DECLARE INTEGER ShellExecute ;
 IN SHELL32.dll ;
 INTEGER nWinHandle, ;
 STRING cOperation, ;
 STRING cFileName, ;
 STRING cParameters, ;
 STRING cDirectory, ;
 INTEGER nShowWindow 

 **retreive the main VFP window handle (this handle is used by ShellExecute)

 DECLARE INTEGER FindWindow ;
 IN WIN32API ;
 STRING cNull, ;
 STRING cWinName 

 z=ShellExecute(FindWindow( 0, _SCREEN.caption), "Open", MonURL, "", "c:\temp\", 1) 

 **Error messages if the return value is < 32

 IF z < 32
 DO CASE
 CASE z=2 
 Wait wind "Bad association or invalid URL , oops!" 
 CASE z=31
 Wait wind "No association , oops!" 
 CASE z=29 
 Wait wind "Can't start the application, oops!" 
 CASE z=30 
 Wait wind "The application is already started, oops!" 
 ENDCASE 
 ENDIF
Gérald Santerre, Gerald Santerre enrg.
Gérald Santerre joined the Universal Thread team in November 2001. After the completion of his programming course, he began working for a small shop with FoxPro Windows. A couple of months later, Microsoft launched Visual FoxPro 3 and he started his journey in the world of OOP. He worked for the National Bank of Canada Intranet doing Web programming with VFP. Since January 2001, he became self employed and he has designed some applications for the Nortel Network's, Bombardier's Intranet site and for other customers as well. He is always open to new contract opportunities, so feel free to contact him!
More articles from this author
Gérald Santerre, January 14, 2002
The type of small binary file that come to mind was the cursor files. These littles files that we must copy somewhere on the user machine during install. If you have icons or bitmaps, it's not a problem, the files can be build into the executable. But the cursor must reside on the disk somewhere nea...
Gérald Santerre, February 1, 2002
Gérald Santerre, from the Universal Thread, has interviewed Whil Hentzen, from Hentzenwerke Corporation in mid January. We initiated some topics on the company, the Visual FoxPro book publishing and the Great Lakes Great Database Workshop conference. Who is Whil Hentzen? (Looking over shou...
Gérald Santerre, February 1, 2002
Gérald Santerre, from the Universal Thread, has interviewed Claudio Lassala, from FoxTotal Network in mid January. Claudio Lassala joined the Universal Thread team in January 2002. He has been recently awarded as a VFP MVP. He is involved in various areas such as being the co-editor of the UTMag/Rap...
Gérald Santerre, January 1, 2001
Cet article est un extrait de ce que vous pouvez trouver sur ma home page http://www.total.net/~gersan. Ce site est avant tout un site maison, il est sans prétentions. Si vous y trouvez quelque chose qui vous intéresse, prenez le! BTW, it's all in french!
Gérald Santerre, March 25, 1998
This drawa a partial circle or pie in Visual FoxPro. You can pass the current positions of the center of the circle to trace, the radius of the circle, the start angle, the width of the angle to draw, the line width and a parameter to detect if you want to draw a pie or not.
Gérald Santerre, March 1, 2002
Gérald Santerre, from the Universal Thread, has interviewed John Petersen, president and founder of Main Line Software, Inc., a Philadelphia, Pennsylvania based software application and database design firm. MLSI development platforms include Visual FoxPro, Visual Basic, Access, and SQL-Server in mi...
Gérald Santerre, June 1, 2002
As you may have noticed, Microsoft has recently launched a new community program named ".Net Code Wise Community". Universal Thread has been chosen as a founding member of this program. It was in this context that we have interviewed Josh Levine, the Business Development Manager for MSCOM who helped...
Gérald Santerre, January 1, 2002
Monday, 31 December 2001, I was on my way to go to the new year party with my wife's family and I read a mail from Michel, between other things I see this little sentence: "BTW, have you prepared your profile for the UT Magazine?". Duh! Pardon?... "Sorry, I have send a mes...
Gérald Santerre, June 1, 2002
You spent a lot of time on the Universal Thread on a regular basis. You have noticed that the site is always on evolution. But, do you know who is behind the scene to constantly enhance your experience online? Who is Michel Fournier? After having graduated in computer science in 1987, I m...