用默认浏览器打开 URL
welcome to http://bccv.songstech.com/
HKEY hkRoot,hSubKey; //定义注册表根关键字及子关键字 char ValueName[256]; unsigned char DataValue[256]; unsigned long cbValueName=256; unsigned long cbDataValue=256; char ShellChar[256]; //定义命令行 DWORD dwType; //打开注册表根关键字 if(RegOpenKey(HKEY_CLASSES_ROOT,NULL,&hkRoot)==ERROR_SUCCESS) { //打开子关键字 if(RegOpenKeyEx(hkRoot, "htmlfile\\shell\\open\\command", 0, KEY_ALL_ACCESS, &hSubKey)==ERROR_SUCCESS) { //读取注册表,获取默认浏览器的命令行 RegEnumValue(hSubKey, 0, ValueName, &cbValueName, NULL, &dwType, DataValue, &cbDataValue); // 调用参数(主页地址)赋值 strcpy(ShellChar,(char *)DataValue); strcat(ShellChar," www.sina.com.cn"); // 启动浏览器 WinExec(ShellChar,SW_SHOW); } else MessageBox("WEB浏览器打开错误!","错误",MB_OK); } else MessageBox("WEB浏览器打开错误!","错误",MB_OK); //关闭注册表 RegCloseKey(hSubKey); RegCloseKey(hkRoot);
注:转载文章需注明来源:VCer.net 文章地址:http://vcer.net/1041.html
如果你觉得VCer.net不错,而且你愿意为VCer.net捐赠一元钱,那么点击后面的捐赠按钮吧:)
A B C D E
bluejoe 于 2004-04-19 21:23:54.0 编辑 [回复该贴]