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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Launching applications from C++ code 2

Status
Not open for further replies.

StukA

Programmer
Apr 11, 2001
115
US
How would I go about launching Internet Explorer (or perhaps the appropriate default browser) from within a C++ app? I've found the ShellExecute() method, but how do I get the correct path to IE (or the default browser)? I know where it usually hides, of course, but this needs to be fairly sturdy....Anyone ever done this?
 
Yes, it works. The Funktion take the path to default browser from registry.
 
One way to do this is to just launch a document, which will automatically launch the default browser:

// Launch IE with a web page open
CString sPage = "http:\\\\msdn.microsoft.com\\visualc";
ShellExecute( 0, "open", sPage, NULL, sPage, 0 );

// Launch IE with a local page open
CString sFile = "c:\\sample page.htm";
ShellExecute( 0, "open", sFile, NULL, sFile, 0 );
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top