//判断是否兼容WPS
BOOL CompatibleWPS()
{
BOOL bOpenByWPS = FALSE;
HKEY hKey;
//WPS注册表路径
LPCTSTR strSubKey = L"Software\\Kingsoft\\Office\\6.0\\Common";
long lRet = ::RegOpenKeyEx(HKEY_CURRENT_USER, strSubKey, 0, KEY_QUERY_VALUE, &hKey);
if (lRet == ERROR_SUCCESS)
{
DWORD dwValue = 0;
DWORD dwSize = sizeof(dwValue);
DWORD dwType = REG_DWORD;
//获取数据值 1表示兼容WPS
if (::RegQueryValueEx(hKey, _T("compatible_type"), 0, &dwType, (LPBYTE)&dwValue, &dwSize) == ERROR_SUCCESS)
{
if (1 == dwValue)
{
bOpenByWPS = TRUE;
}
}
//程序结束,关闭打开的hKEY
RegCloseKey(hKey);
}
return bOpenByWPS;
}
判断是否兼容WPS
最新推荐文章于 2023-04-11 17:26:56 发布