11-09-2009 10:51 PM
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;
}
11-09-2009 11:54 PM
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;
}
11-09-2009 11:59 PM
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
11-10-2009 12:15 AM
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.