LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

TerminateExecutable

 hi im trying to TerminateExecutable, iim keep getting invalid and error.

 

 

int *a=0;
int b=0;
int main()
{
    int NumberOfFramesToSelect=0;
    NumberOfFramesToSelect=8;
   
    //Start up DAS3000 software visually
    //LaunchExecutable("C:\\DAS3000\\Das.exe");
   
   
    b=LaunchExecutableEx ("C:\\DAS3000\\Das.exe",LE_SHOWNORMAL,(int*)a );
   
    //Connect to the AutoEOD software
    Connect_Auto_Eod_Software();
   
    //Initialize AutoEOD and DAS3000 automation software
    Initialize_Software();
   
    //Configure the number of framegrabs
    Configure_Frame_Grabs(NumberOfFramesToSelect);
   
    Sleep(RSP_WAIT_TIME);//milliseconds
   
    Set_Parameters_Capture_Centroid(NumberOfFramesToSelect);
   
    //if(hAppObj)
    TerminateExecutable (b);
   
    return VI_SUCCESS;
}
 

0 Kudos
Message 1 of 4
(3,281 Views)

You are actually passing a wrong handle to TerminateExecutable: LaunchExecutableEx retrieves the handle of the executable in the last parameter (which by the way should be an integer passed by reference), while its return value is a status code. Now, you are passing this status code ('b' in your code) as the handle to TerminateExecutable, hence the error. Read the online help for the command.

 

Modify your code as follows:

 

int a=0;
int b=0;

int main()
{

    // ....


    b = LaunchExecutableEx ("C:\\DAS3000\\Das.exe", LE_SHOWNORMAL, &a);

    // ...

    
    TerminateExecutable (a);


    return VI_SUCCESS;
}
 



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 4
(3,276 Views)

Why do you trash the handle which is given by LaunchExecutableEx() as Outputparamter ?

Your call to LaunchExecutableEx() should read

 status =LaunchExecutableEx ("C:\\DAS3000\\Das.exe",LE_SHOWNORMAL, &b);

if ( status < 0)  .... // some error handling

 

And don't forget to call

RetireExecutableHandle (b);

before the end of your program

 

0 Kudos
Message 3 of 4
(3,274 Views)

But Roberto, I thought YOU are the on-line help.

 

But seriously Darnell: you might get some answers even quicker than Roberto answers them if you look at the help for functions you're having problems with. 

0 Kudos
Message 4 of 4
(3,271 Views)