3,245
社区成员
发帖
与我相关
我的任务
分享
struct __declspec(uuid("612423e6-f1e0-40d7-ae35-253f66f527ab"))
_DActiveT2 : IDispatch
{
//
// Wrapper methods for error-handling
//
// Methods:
long T2SUB (
long ina,
long inb );
HRESULT T2TEST ( );
HRESULT AboutBox ( );
};
#import "C:\Workspace\activeT2\Debug\activeT2.ocx" no_namespace named_guids
void CActiveDemoDlg::OnButton1()
{
// TODO: Add your control notification handler code here
HRESULT hr;
CoInitialize(NULL); //initialize COM library
_DActiveT2 *pSock;
hr = CoCreateInstance(CLSID_ActiveT2, NULL, CLSCTX_ALL, DIID__DActiveT2,//__uuidof(_DActiveT2),
reinterpret_cast <void **>(&pSock));
if(FAILED(hr))
{
MessageBox("Creation Failed", 0, 0);
return;
}
//pSock->T2SUB(56, 11);
pSock->T2TEST(); // ***** Look at me,crash at here ******
char bufret[64] = {0};
sprintf(bufret, "call active2 ret:%d", 0);
MessageBox(bufret, 0, 0);
CoUninitialize(); //Unintialize the COM library
}