MFC/////Open Web page with default browser//if default browser is not found, the default is open with IE on void OpenURL (const CString & OpenURL) {if (OpenURL = = "") Retu
Rn Hkey Hkroot, Hsubkey;
Registry root keyword and sub-keyword CString valuename;
unsigned char Datavalue[max_path];
unsigned long cbvaluename = MAX_PATH;
unsigned long cbdataname = MAX_PATH;
<pre name= "code" class= "CPP" ><pre name= "code" class= "CPP" > CString shellchar;//define command line DWORD dwtype; Open the Registry root keyword if (regopenkey (hkey_classes_root,null,&hkroot) = = ERROR_SUCCESS) {//Open the Child keyword if (Re
Gopenkeyex (hkroot,l "Htmlfile\\shell\\open\\command", 0, key_all_access, &hsubkey) = = ERROR_SUCCESS) {
. RegEnumValue (Hsubkey, 0, (LPWSTR) Valuename.getbuffer (MAX_PATH), &cbvaluename, NULL, &DW
Type, DataValue, &cbdatavalue);
Valuename.releasebuffer ();
Call parameter Assignment Shellchar = (char *) DataValue;
if (Shellchar = = "" ") {ShellExecute (NULL, L "open", (LPWSTR) Openurl.getbuffer (MAX_PATH), NULL, NULL, SW_SHOWNORMAL);
Openurl.releasebuffer ();
else {Shellchar = Shellchar + OpenURL;
WinExec ((LPCSTR) Shellchar.getbuffer (MAX_PATH), sw_show);
Shellchar.releasebuffer ();
} else {RegCloseKey (hsubkey); RegCloseKey (Hroot); <pre name= "code" class= "CPP" ><pre name= "code" class= "CPP" > ShellExecute (NULL, L "open", (LPWSTR) Open
Url.getbuffer (MAX_PATH), NULL, NULL, SW_SHOWNORMAL); <pre name= "code" class= "CPP" ><pre name= "code" class= "CPP" ><pre name= "code" class= "CPP" > Open Url.releasebuffer ();
}
}
}