Void cxh1_dlg: onbtnweb () { Hkey hkroot, hsubkey; // defines the root keyword and subkeyword of the Registry. Char valuename [256]; Unsigned char datavalue [256]; Unsigned long cbvaluename = 256; Unsigned long cbdatavalue = 256; Char shellchar [256]; // defines the command line DWORD dwtype; // Open the Registry root keyword If (regopenkey (hkey_classes_root, null, & hkroot) = error_success) { // Open the subkeyword If (regopenkeyex (hkroot, "Htmlfile // shell // open // command ", 0, Key_all_access, & Hsubkey) = error_success) { // Read the registry and obtain the command line of the default browser Regenumvalue (hsubkey, 0, Valuename, & Cbvaluename, Null, & Dwtype, Datavalue, & Cbdatavalue ); // Call parameter (Home Address) Assignment Strcpy (shellchar, (char *) datavalue ); Strcat (shellchar, "www.neaase.net /~ Xiaohui "); // Start the browser Winexec (shellchar, sw_show ); } Else MessageBox ("An error occurred while opening the web browser! "," Error ", mb_ OK ); } Else MessageBox ("An error occurred while opening the web browser! "," Error ", mb_ OK ); // Close the registry Regclosekey (hsubkey ); Regclosekey (hkroot ); } |