# c++ program to launch browser



## eric_sc (Sep 17, 2007)

hi, i'm new to c++ and was hoping someone could help me with some code to start off a program that launches internet explorer and directs the user to a specific website. I feel like this should not be too difficult but have not learned this type of code yet.


----------



## mt2002 (Sep 14, 2005)

An easy way is either using system() or the Win32 APIs ShellExecute() routine. Keep in mind that what you are requesting is system specific and not portable in any way. Use it to open "iexplore.exe" (Internet Explorer) passing the command-line of the web site you want to open.


----------



## midders (Jan 1, 1970)

mt2002 said:


> Keep in mind that what you are requesting is system specific and not portable in any way.


I'm a little rusty but I think there's an API function that will return the path to the various "System" folders common to windows installations (e.g. GetSystemFolder("Program Files"); ). You can then check for the existence of the various common browser folders (Internet Explorer, Mozilla Firefox, Opera etc.) within this folder and use the results to make your program work on most systems.

Sláinte

midders


----------



## mt2002 (Sep 14, 2005)

midders: You are correct; however your solution is still Windows dependent. There is no solution defined by the standard thus no portable way.


----------

