I’m trying to get a handle to an wrapped ActiveX class like this:
(The ActiveX is running inside AutoCad.)
_DDataBaseTreeView *pPE; // the ActiveX class
HRESULT res;
CLSID clsid;
CLSIDFromProgID(L"NetModeler.DataBaseTreeView.1", &clsid);
IUnknown *pUnk = NULL;
IDispatch *pDisp = NULL;
HRESULT hr = GetActiveObject(clsid, NULL, (IUnknown**)&pPE);//pUnk);
if(SUCCEEDED(hr))
{
hr = pUnk->QueryInterface(IID_IDispatch, (void**)&pDisp );
if( SUCCEEDED(hr) )
{
// this happens if the ActiveX is running!!
}
}
_variant_t var;
//pPE->AttachDispatch( pDisp );
var = pPE->Func(); // CRACH!!!!!!!!!!!!
What have I missed?
I want to have a handle to an already running ActiveX inside AutoCad.
(The ActiveX is running inside AutoCad.)
_DDataBaseTreeView *pPE; // the ActiveX class
HRESULT res;
CLSID clsid;
CLSIDFromProgID(L"NetModeler.DataBaseTreeView.1", &clsid);
IUnknown *pUnk = NULL;
IDispatch *pDisp = NULL;
HRESULT hr = GetActiveObject(clsid, NULL, (IUnknown**)&pPE);//pUnk);
if(SUCCEEDED(hr))
{
hr = pUnk->QueryInterface(IID_IDispatch, (void**)&pDisp );
if( SUCCEEDED(hr) )
{
// this happens if the ActiveX is running!!
}
}
_variant_t var;
//pPE->AttachDispatch( pDisp );
var = pPE->Func(); // CRACH!!!!!!!!!!!!
What have I missed?
I want to have a handle to an already running ActiveX inside AutoCad.