HRESULT hresult;
CLSID clsid;
CoInitialize(NULL);
hresult=CLSIDFromProgID(OLESTR("ACTIVEDEMO6.activedemo6Ctrl.1"), &clsid);
_Dactivedemo6 *t = NULL;
hresult=CoCreateInstance(clsid,NULL,CLSCTX_INPROC_SERVER,__uuidof(_Dactivedemo6),(LPVOID *) &t);
if(FAILED(hresult))
{
printf("call ocx/dll failed");
return 0;
}
char str[20];
t->hellostr(str);
printf("%s",str);
t->Release();
CoUninitialize();
return 0;
按网上的方法写了上面的程序,在win32控制台工程,编译没有错误。但程序跑到 t->hellostr(str);就出现这样的错误:
Win32test.exe 中的 0x76dbc52f 处未处理的异常: Microsoft C++ exception: _com_error @ 0x0018fc4c 。
急,求助大神了