Discussion:
Is it possible to shutdown TestStand LabWindows/CVI operator interface programmatically?
(too old to reply)
Daniel Coelho
2008-08-08 10:40:11 UTC
Permalink
Hello,
I'm trying to do the same thing.
But I don't know what is that TestStand prepackage.
I have a button that runs a CALLBACK on LabWindowsCVI where I call TSUI_ApplicationMgrShutdown and I check the canExitNow flag.
But since canExitNow only returns TRUE on the second TSUI_ApplicationMgrShutdown how do I close TestStand without having to click the button two times?
I apreciate your help on this.
Thanks in advance.
 
Daniel Coelho
 
Ray Farmer
2008-08-08 11:10:12 UTC
Permalink
Hi,
You dont need to modify the OI.
you should be able do the same from the command line eg

SeqEdit.exe /run MainSequence "c:\My Seqs\test\seq" /quit

This is for the SeqEditor but the same should hold true of the Operator Interface.

Regards

Ray Farmer

 

 
Daniel Coelho
2008-08-08 11:40:10 UTC
Permalink
Thanks for the quick reply.
I think that isn't what I have in mind.
I really want to programmatically close teststand using TSUI_AplicationMgrShutdown ().
The thing is that I need to click close twice in orden to close.
Any ideas on how to close teststand on the first click?
Thanks for you time.
 
Daniel Coelho
 
Manooch_H
2008-08-11 22:10:09 UTC
Permalink
Hello Daniel, If in order to shutdown TestStand you need to click your button and execute the callback code twice, you could put a for loop around the code in your callback and have it iterate twice so that you only have to click the button once.Let me know if you run into any problems.
Daniel Coelho
2008-08-12 08:40:11 UTC
Permalink
Thank you for your reply.
I did a loop but it wouldn't work :s
I managed to create an ActiveX button to exit test stand.
I found an example within the TestStand Course I and II.
..
static void ExitApplication(void){  VBOOL canExitNow;
 TSUI_ApplicationMgrShutdown (AppManagerHandle, &errorInfo,&canExitNow); if (canExitNow)  QuitUserInterface(0);}
// the ApplicationMgr control sends this event when it is ok to exit the application.HRESULT CVICALLBACK ApplicationMgr_OnExitApplication(CAObjHandle caServerObjHandle, void *caCallbackData){  ExitApplication();  return S_OK;}
void CreateTSEngineHandle (){  GetObjHandleFromActiveXCtrl  (panelHandle, PANEL_APPLICATIONMGR,&AppManagerHandle); GetObjHandleFromActiveXCtrl  (panelHandle, PANEL_EXIT,    &AppExit   );   TSUI__ApplicationMgrEventsRegOnExitApplication (AppManagerHandle, ApplicationMgr_OnExitApplication, NULL, 1, NULL);  TSUI_ApplicationMgrConnectCommand (AppManagerHandle, &errorInfo, AppExit, TSUIConst_CommandKind_Exit, 0,            TSUIConst_CommandConnection_NoOptions, NULL);  TSUI_ApplicationMgrGetEngine (AppManagerHandle, &errorInfo,&EngineHandle);  TSUI_ApplicationMgrStart     (AppManagerHandle, &errorInfo);  TS_EngineGetGlobals(EngineHandle,NULL,&Globals);}
..
This way I click my QuitButton and it calls the the ActiveXExitButton witch calls the ExitApplication function.
The ApplicationMgr control sends ApplicationMgr_OnExitApplication event when it is ok to exit the application.
Hope this was clear enough and I hope this may be helpfull for someone else. 
I apreaciate all the help.
Regards,
Daniel Coelho
 

Loading...