您的位置:首页 > 其它

wm通过注册表获得UA

2011-03-02 16:40 369 查看
WM:

1.通过注册表

CString CTyydApp::GetUserAgent()
{
HKEY hKey = NULL;
DWORD dwValue;
LONG rc = NULL;
CString strUserAgent = _T("");
rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"//Security//Internet Explorer//User Agent", 0, 0, &hKey);
if (rc == ERROR_SUCCESS)
{
RegQueryValueEx(hKey, L"CustomBase", NULL, NULL, NULL, &dwValue);
BYTE* pBuf = new BYTE[dwValue];
RegQueryValueEx(hKey, L"CustomBase", NULL, NULL, pBuf, &dwValue);
strUserAgent.Format(L"%s", pBuf);
delete[] pBuf;
RegCloseKey(hKey);
}
return strUserAgent;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: