Windows获取默认浏览器(2)
// //在前一种方法注册表找不到的情况下使用 // BOOL GetDefaultBrowser(LPTSTR lpBuffer,DWORD nSize) { TCHAR temp[MAX_PATH]={0}; DWORD dwDataSize = sizeof(temp); TCHAR *p; ZeroMemory(lpBuffer,nSize*sizeof(TCHAR)); if(0!=RegGetValue(HKEY_CLASSES_ROOT, TEXT("http\\shell\\open\\command"), 0, RRF_RT_REG_SZ, 0, temp, &dwDataSize )) { return 0; } //去引号参数 if (temp[0]==L'\"') { p=_tcschr(&temp[1],'\"'); memcpy(lpBuffer,&temp[1],(p-&temp[1])*sizeof(TCHAR)); } return TRUE; }
浙公网安备 33010602011771号