开发者

cocreateinsatnce returns the system cannot find the file specified in COM

开发者 https://www.devze.com 2023-02-18 07:11 出处:网络
CoInitialize(NULL); GCalender::IGCalenderSync* pGCalender; HRESULT hr = CoCreateInstance(__uuidof(GCalender::GCalenderSyncHelper),NULL,
 CoInitialize(NULL);
GCalender::IGCalenderSync* pGCalender;
HRESULT hr = CoCreateInstance(__uuidof(GCalender::GCalenderSyncHelper),NULL, 
   CLSCTX_INPROC_SERVER,__uuidof(GCalender::IGCalenderSync),(void**)&pGCalender);

GCalender::GenericEvent HUGEP *pDeletedEvents;  
GCalender::GenericEvent HUGEP *pUpdatedEvents;  
GCalender::GenericEvent HUGEP *pNewEvents;  

SAFEARRAY* deletedEvents, *updatedEvents, *newEvents;
pGCalender->GetAllEvents(&deletedEvents, &updatedEvents, &newEvents);

hr = SafeArrayAccessData(newEvents, (void HUGEP* FAR*)&pNewEvents);
SafeArrayUnaccessData(newEvents);
hr = SafeArrayAccessData(deletedEvents, (void HUGEP* FAR*)&pDeletedEvents);
SafeArrayUnaccessData(deletedEvents);
hr = SafeArrayAccessData(updatedEvents, (void HUGEP* FAR*)&pUpdatedEvents);
SafeArrayUnaccessData(updatedEvents);
CoUninitialize();

in the above code the HR value is 0X8007002 ( system cannot find the file specified) How to resolve thi开发者_StackOverflow中文版s.


That happens if the COM server for the class id you passed into CoCreateInstance() is registered, but for whatever reason the .dll file or one of its dependencies can't be found. Your best bet is Process Monitor utility - it will let you see what file exactly is missing.

0

精彩评论

暂无评论...
验证码 换一张
取 消