HOWTO: launch a web browser from a win32 app (code)
by at 12:01 PM
I needed to know this for a simple app at work and, not being a Win32 programmer, I couldn't find it documented, so to hopefully save someone else a wild goose chase:
ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL);
where url is an ordinary char* string.
Comments
Note that it opens your default browser.
Also...I hope you're validating input, because an URL of "file://Program Files/RootkitInstall.exe" won't open the browser...
For extra fun, you could use things like 'edit' or 'print'.
also the URLs are generated by the app, which is only used internally anyway.