NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

teststand.engine activex control

Hi,

I'm trying to write my own custom operator interface (VC++ 6.0).
But when importing the ActiveX Control (Teststand.Engine) and trying to compile.
I get the following error:

sequencecontext.cpp(276) : error C2440: 'type cast' : cannot convert from
'struct IDispatch *' to 'class CEngine'
No constructor could take the source type, or constructor overload
resolution was ambiguous

the function it is talking about is outlined below:

CEngine CSequenceContext::GetEngine()
{
LPDISPATCH pDispatch;
InvokeHelper(0x3c, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&pDispatch,
NULL);
return CEngine(pDispatch);
}

The errro is on the line where the return is specified: saying that it can
not convert the LPDISPATCH parameter.

c
an someone help me out here...
0 Kudos
Message 1 of 2
(3,284 Views)
Gert,

The following code worked for me when initializing the TestStand.Engine:

void CSimpleMFCOperatorInterfaceDlg::InitializeEngine(void)
{
HRESULT res = m_engine.CreateInstance("TestStand.Engine");

m_engine->PutUIMessageMinDelay(0);

// Let the engine know what the main window handle is so it can put up modal dialogs
m_engine->PutAppMainHwnd((long)m_hWnd);

m_engine->LoadTypePaletteFiles();

return;
}

I compiled and ran this function under VisualC++ 6.0, SP 3.

Hopefully it works for you as well,

Azucena
0 Kudos
Message 2 of 2
(3,284 Views)