Hi i got an application that uses the mso.dll and MSOUTL.OLB :

#pragma warning(disable: 4146)

#import "C:\Program Files\Common Files\Microsoft Shared\Office10\\mso.dll" named_guids

#pragma warning(default: 4146)

#import "C:\Program Files\Microsoft Office\Office10\MSOUTL.OLB" no_namespace exclude("_IRecipientControl", "_DRecipientControl")

In which I'm trying to create an instance of the "Outlook.Application" in the following way:

_ApplicationPtr vApplicationPtr;

HRESULT  vHRESULT = vApplicationPtr.CreateInstance("Outlook.Application");


This does work fine for me in various Windows and various Office versions, but even if it works in a specific Windows with an Office it might not work on another pc with the exact same Windows and the exact Office... what could be the reasons that it enters the "if (FAILED(vHRESULT))" block?

I'd be surprised if there wasn't some "getlasterror" function you could call to find out more.

Perhaps you should read the manual on CreateInstance, look to see how it returns additional error information, then use that in your program.