NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I set an UIMessage Callback in a step module (MFC DLL) written in MSVC++

I'm implementing a TestStand step module as a MFC DLL in Visual C++. The step module is run from SequenceEditor, and the Engine is passed to the exported function as an ActiveX reference from the
TestStand property "RunState.Engine". In my DLL I have another function declared as follows:

void __cdecl OnUIMessageEventEngine(struct IDispatch *msg)
{
...
};

I used the engine.RegisterUIMessageCallback function with 'OnUIMessageEventEngine' as a parameter,
but the engine never calls into 'OnUIMessageEventEngine' function.

Can anyone tell me what is wrong?
Silvius Iancu
0 Kudos
Message 1 of 2
(2,972 Views)
Silvius,

The RunState.Engine is a reference to the Engine object that was created by the Sequence Editor. The Sequence Editor is receiving and handling all the UIMessages at this point.
Usually one handles UIMessages only inside an Operator Interface. On NI's website we have several MFC Operator Interfaces you can download and examine.
When the Sequence Editor calls your DLL, it passes a reference to the Engine object but the handling of UIMessages stays with the Seq. Editor.

One cannot handle Engine UIMessages inside a code module that a sequence calls.
Feel free to reply in case you have other questions.

Regards,

Azucena Perez
Message 2 of 2
(2,972 Views)