Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Launch IE from a C++ program

I have a program written in C++ which does some computer diagnostics. Before the program exits, I need it to launch Internet Explorer and navigate to a specific URL. How do I do that from C++? Thanks.

like image 877
Jon Avatar asked Nov 30 '22 07:11

Jon


1 Answers

Here you are... I am assuming that you're talking MSVC++ here...

// I do not recommend this... but will work for you
system("\"%ProgramFiles%\\Internet Explorer\\iexplore.exe\"");


// I would use this instead... give users what they want
#include <windows.h>

void main()
{
     ShellExecute(NULL, "open", "http://stackoverflow.com/questions/982266/launch-ie-from-a-c-program", NULL, NULL, SW_SHOWNORMAL);
} 
like image 95
MichaelICE Avatar answered Dec 01 '22 20:12

MichaelICE