Skip to main content
gamedev.net
🔒 Locked

Opening Web Browser

Started by froghaus 0 replies 1k views
Original Post
froghaus
froghaus
I'm working on an advertising system that would allow my game to host advertising banners and open a web browser window when the player clicks on the ad. What code could I use to do this? Basically, all I want to do is say: if(user_clicks_on_ad) { tell_windows_to_fire_up_the_browser("hey_browser_open_this_address"); } Thanks for any help.
LessBread
LessBread
There's a description of one approach here.

Quote:

6 Full examples:
Launches index.html in Internet Explorer:
int PASCAL WinMain(HANDLE,HANDLE,LPSTR,int)
{
ShellExecute(NULL,"open","iexplore","index.html",NULL,SW_SHOWNORMAL);
return 0;
}

Launches index.html in the user's default HTML viewer:
int PASCAL WinMain(HANDLE,HANDLE,LPSTR,int)
{
ShellExecute(NULL,"open","index.html",NULL,NULL,SW_SHOWNORMAL);
return 0;
}

7 To make the application more robust, you may wish to add error checking to the ShellExecute call. Visit ShellExecute (MSDN Library) for the official Microsoft technical information on this command.
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.