Question

I have a class that is using Windows Automation. It works fine on newer OSs (like 7 - 8 and 8.1) but on Windows XP (using SP3 and latest updates it crashes).

The code that produces the crash is:

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(...)
  {
  }
}

Do you have any suggestion how to fix this problem?

Thank you!

Was it helpful?

Solution

The requirements section of the MSDN documentation states the following minimum requirements:

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]

It seems quite plausible that you have not installed the Platform Update.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top