Hi guys,

This might be a long shot but its worth a go....so im using LabWindows CVI, a ANSI C software development environment for "test and measurement, data acquisition, instrument control, and scientific analysis" application.

Now the problem I have is running a .exe application from a button click event:

int CVICALLBACK BrowseFileCallback (int panel, int control, int event,void *callbackData, int eventData1, int eventData2)
{
	char h2bPath[] = "C:\\Test\\HEX2BIN.EXE";
	switch (event)
	{
		case EVENT_COMMIT:
				FileBrowser_Refresh (panelHandleFileBrowse, PANELFILE_FILEBROWSER, 0);
				DisplayPanel (panelHandleFileBrowse);
		
			
				//LaunchExecutable("C:\\Test\\HEX2BIN.EXE  Project.hex proj.bin");
				system("c:\\Test\\HEX2BIN.bat"); 
		break;																																						  
	}
	return 0;
}

I need to be able to run the HEX2BIN.exe application with the parameters "Project.hex" and "proj.bin", this firstly caused an error in the C code, so I went another way around this by putting the following into a .bat file

C:\\Test\\HEX2BIN.EXE Project.hex proj.bin

pause

Now this batch file works fine when I run it physically (double clicking the icon)...however when I run it inside the program the cmd line window appears and a message "The system cannot execute the specified program".

Any ideas or suggestions?

Thanks

PS I have already asked at the LabWindows forum.

You probably need to specify the full path of both input files, too.

[...inside the batch file]

C:\Test\HEX2BIN.EXE c:\whatever\Project.hex c:\whatever\proj.bin

or if all of the files are in the same directory

c:
cd\Test
HEX2BIN Project.hex proj.bin

Awesome thanks for the response.

I have sussed it, when running the .exe it needs the full location of both files (.hex and .bin), the hex2bin.exe needs to be in the root file of the application, and the file location needs to have NO spaces...so pretty much what you have provided their thines01!

Cheers

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.