我有一个使用 Windows 自动化的类(class)。它在较新的操作系统(如 7 - 8 和 8.1)上运行良好,但在 Windows XP 上(使用 SP3 和最新更新时会崩溃)。
产生崩溃的代码是:
void CUIAutomationClient::Initialize()
{
try
{
CoInitialize(NULL);
HRESULT hr;
hr = CoCreateInstance(__uuidof(CUIAutomation), NULL,
CLSCTX_INPROC_SERVER,
__uuidof(IUIAutomation),
(void **)&g_Automation);
if(FAILED(hr) || g_Automation==NULL)
{
CoUninitialize();
}
}
catch(...)
{
}
}
你对如何解决这个问题有什么建议吗?
谢谢!
最佳答案
MSDN documentation 的要求部分规定了以下最低要求:
Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista, Windows XP with SP3 and Platform Update for Windows Vista [desktop apps only]
很可能您没有安装平台更新。
关于c++ - 带有最新 sp3 和更新的 XP 上的自动化崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22758166/