I want to read Windows Contacts (Windows 7 address book) but the CoGetClassObject returns an error and I don't know why ?
My code is :
IClassFactory* pFactory = NULL;
HRESULT rc;
rc = CoGetClassObject(CLSID_Contact,CLSCTX_INPROC_SERVER,NULL,IID_IClassFactory, (void **) &pFactory);
wprintf( L"Error : %d\n",rc);
It returns "Error : -2147221008"
If someone had a suggestion for me it would be wonderful !
Denis
P. S. Details : Based on http://msdn.microsoft.com/en-us/library/ms735866.aspx (which is quite bugged) I tried to do it myself but function CoGetClassObject returns an error and I don't know why ?
This number is 0x800401F0 when printed as a hex number
This error translates to CoInitialize has not been called.
Call CoInitialize
before calling any COM code
If you have visual studio, you can find the error lookup tool under the Tools menu for future use