Wednesday 15 January 2014

How to open a URL in the default web browser?


This is easily done by calling ShellExecute() HTTP and FTP URLs should be processed by both Netscape and IE: the "default" browser will handle them. Other protocols such as mailto and news may also handled by the browser. IE4 adds handlers for things like "Callto:" for Net Meeting contacts.

#include "windows.h"
 #include "shellapi.h"
 //link in the library
#pragma comment(lib,"shell32.lib")
 
int main(int argc, char *const argv[])
{
    ShellExecute(NULL,"open", "http://coderdreambook.blogspot.in/", "", "c:\\", SW_SHOWNORMAL);
    return 0;
}

No comments: