问题
I based my code on http://msdn.microsoft.com/en-us/library/ms735866.aspx which is quite bugged, after some adaptation of function CreateNewContact() I tried the following.
I don't have errors anymore but nothing is happening :
IClassFactory* pFactory = NULL;
HRESULT rc;
rc = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
if (rc == S_OK)
rc = CoGetClassObject(CLSID_Contact,CLSCTX_INPROC_SERVER,NULL,IID_IClassFactory, (void **) &pFactory);
if (rc == S_OK)
rc = CreateNewContact( pFactory);
if (rc == S_OK)
wprintf( L"Created\n");
I get "Created" but I don't see any new contact in C:\Users\myself\Contacts but only my existing contacts.
I don't copy CreateNewContact() here as it can be found on the URL.
Any help would be greatly appreciated !
来源:https://stackoverflow.com/questions/10372035/trying-to-read-windows-7-contacts-doesnt-work