03-24-2008 01:13 PM
void
__declspec(dllexport) __stdcall PostStep(struct IDispatch* pSeqContextDisp){
AFX_MANAGE_STATE(AfxGetStaticModuleState()); PropertyObjectPtr spThisContext=pSeqContextDisp; try{
// ... return PostStepEx(spThisContext);}
catch(_com_error& xComErr){
// ...}
}
void
PostStepEx(PropertyObjectPtr& spThisContext){
SequenceContextPtr spSeqContext=spThisContext; StepPtr spStep=spSeqContext->GetStep(); PropertyObjectPtr spResultStep=spStep->AsPropertyObject(); bool fSomeCondition=false; // Evaluate fSomeCondition if(fSomeCondition){
spResultStep->SetValBoolean("Result.Error.Occurred", 0, VARIANT_TRUE); spResultStep->SetValString ("Result.Error.Msg", 0, "Some error message"); spResultStep->SetValNumber ("Result.Error.Code", 0, -1); return;}
// Continue ...}
When step of this custom step type is beeing executed and fSomeCondition evaluated to true, the error is displayed:
Details:
"Error executing substep 'Post'.
Some error message"
How to instruct TestStand to not to add prefix "Error executing substep 'Post'." ?
thanks.misha
03-25-2008 12:06 PM
03-26-2008 09:06 AM
spResultStep->SetValBoolean("Result.Error.Occurred", 0, VARIANT_TRUE);
spResultStep->SetValString ("Result.Error.Msg", 0, "Some error message");spResultStep->SetValNumber ("Result.Error.Code", 0, -1);
03-26-2008 09:43 AM
Why are you using the keyword __stdcall ? Is it working when you remove it?
Hope this helps
Juergen
03-26-2008 10:06 AM
Jurgen,
The following two lines are equivalent:
spResultStep->SetValString ("Result.Error.Msg", 0, _bstr_t("Some error message"));
spResultStep->SetValString ("Result.Error.Msg", 0, "Some error message");
Calling convention (__stdcall) can not affect application logic.
The problem is not that this not works, but not works as expected. TestStand adds prefix to my message-this is what I'm trying to prevent.
thanks.misha
03-26-2008 11:30 AM
03-26-2008 12:20 PM
Jurgen,
I tried your proposal. The result is the same.
Interestingly that's NI_MultipleNumericLimitTest's Post-Step set the error, and it appears without prefix.
I reviewed the NI code and not found principal difference with mine.
I don't understand where is my mistake. Can anyone help?
thanks.misha
03-26-2008 02:44 PM - edited 03-26-2008 02:46 PM
03-26-2008 04:59 PM
Hi Misha,
I have written a smal StepType. It is the same.
It looks like, as you assumed, that there is a function around the postsubstep calls. And on Ni's it should be the same! If you are using a codemodule you will not enter with the module postsubstep with your dll.
I have found the Error string at ErrorStrings.ini SUBSTEP_RTE_ELAB = "Error executing substep '%1'." But not found this define in a C* or h file in the hole TS folder
I think this is a task for the Ni-Guys here
Greetings
Juergen
03-27-2008 02:00 PM - edited 03-27-2008 02:00 PM