LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

cancel a C program execution or an external exe program execution on demand

I have to trigger the execution of an exe call wait.exe
 
I have to wait for the end of this wait.exe or to interrupt it if asked by a button
 
What is the best technique to do this
 
I try ti use the command exec.vi but I don't know how to interrupt the execution of the wait.exe i just launched
 
 
Does anybody know the solution
 
Thibaut
0 Kudos
Message 1 of 5
(3,218 Views)
What is the prupose of "Wait.exe"is you don't mind me asking.

If it only waits, why not do it in LV.

If wait has another task, do you have influence on the source code?

If so, build an interupt in the wait.exe.

André
Regards,
André (CLA, CLED)
0 Kudos
Message 2 of 5
(3,213 Views)
Well, you could use command exec with PsKill from Sysinternals.com and kill wait.exe that way.
http://www.microsoft.com/technet/sysinternals/ProcessesAndThreads/PsKill.mspx

Actually, if it comes to that there's probably some Windows API you can use directly from LabVIEW instead. But perhaps you should consider Mr. Buurman's suggestions first.
0 Kudos
Message 3 of 5
(3,207 Views)
the wait.exe is waiting for end of data acquisition
this is not an open source program so I cannot introduce interrupt
 
before the same exe was trigerred  and  on demand interrupted by a C program with the flowwing code::
 
 Attente de la fin de l'acquisition par la cde WAIT.EXE

             ZeroMemory(&si,sizeof(si));                         si.cb=sizeof(si);

             bRetour=CreateProcess(NULL,szCdeWait,  NULL,NULL,FALSE,DETACHED_PROCESS,NULL,NULL,&si,&pi);

             if (bRetour==TRUE)

   {

                                    // Test de l'etat du process WAIT.EXE jusqu'a ce qu'il soit terminé a moins que l'utilisateur n'arrête le scanning

                                     bArretScanning = FALSE;

                                   do

                                   {

                                               dwRetour = WaitForSingleObject(pi.hProcess,0);  // Test et retour immédiat

                                               if(dwRetour == WAIT_OBJECT_0) break;            // Fin du process alors sortie du do-while

// Test du bouton CANCEL de la boite de progression

                                               if (DlgProgression.CheckCancelButton())

                                               {

                                                           // Affichage de la boite de dialogue de confirmation

                                                           if (AfxMessageBox(_T("Voulez vous réellement arrêter le gamma scanning ?"),MB_YESNO)==IDYES)

                                                           {

                                                           // Indication de l'arret demandé par l'utilisateur

                                                           bArretScanning = TRUE;

// Arret du process WAIT.EXE

                                                           Retour = TerminateProcess (pi.hProcess, 0);

}

}          

 

 
 
0 Kudos
Message 4 of 5
(3,182 Views)
See http://forums.ni.com/ni/board/message?board.id=170&message.id=94151&requireLogin=False


Regards,


Wiebe.
0 Kudos
Message 5 of 5
(3,176 Views)