LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Run external .exe in Labwindows

Solved!
Go to solution

Hey guys,

 

Im looking to run the HEX2BIN.exe dos application (as found here: http://www.tech-tools.com/d_hx2bin.htm) in my

Labwindows Application. Now in the command line I use the application like so (the Source .hex file and Destination .bin file):

 

C:\<location>\ HEX2BIN.EXE Project.hex proj.bin

 Now question is how would I implement this into my Labwindows App, I had a go at using both System() and LaunchExecutable() (as suggested http://forums.ni.com/t5/LabWindows-CVI/Function-to-launch-an-external-application-in-CVI/td-p/219340) but I receive a  NON-FATAL RUN-TIME ERROR:   "BootloaderInterface.c", line 641, col 17, thread id 0x00000B9C:   Library function error (return value == -19 [0xffffffed]).

 

//************************************************************************
//          Display File Browser
//*************************************************************************
int CVICALLBACK BrowseFileCallback (int panel, int control, int event,void *callbackData, int eventData1, int eventData2)
{
	switch (event)
	{
		case EVENT_COMMIT:
				//FileBrowser_Refresh (panelHandleFileBrowse, PANELFILE_FILEBROWSER, 0);
				//DisplayPanel (panelHandleFileBrowse);
		
			
				//system("c:\\Documents and Settings\\cepeeng\\My Documents\\CEPE_RH\\CEPE Projects\\Bootloader_PIC_Project\\HEX2BIN.EXE Project.hex proj.bin");
				LaunchExecutable("c:\\Documents and Settings\\cepeeng\\My Documents\\CEPE_RH\\CEPE Projects\\Bootloader_PIC_Project\\HEX2BIN.EXE Project.hex proj.bin");
				
		break;																																						  
	}
	return 0;
}

 

Thanks

 


 

0 Kudos
Message 1 of 7
(6,165 Views)

Just a suggestion - not sure if this will help:

 

c:\\Documents and Settings\\cepeeng\\My Documents\\CEPE_RH\\CEPE Projects\\Bootloader_PIC_Project\\HEX2BIN.EXE Project.hex proj.bin

 

Documents and Settings, My Documents  and CEPE Projects contain spaces.  The function may read them as the end of a segment of the command.  Move your executable to a directory that contains NO spaces (personal preference - I HATE directories with spaces in them and I ALWAYS use underscores when naming folders and files) and see if this helps. 

 

Judy

0 Kudos
Message 2 of 7
(6,159 Views)

Thanks Judy for the response. I will give that a whirl and see what I get.

 

Cheers

0 Kudos
Message 3 of 7
(6,143 Views)

Have just tried that method but unfortunately no luck....any other suggestions?

0 Kudos
Message 4 of 7
(6,141 Views)

Ok so I am trying another way around this. Instead of trying to open the .exe directly I have put the following inside a .bat file and try to run that instad

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

pause

 Now this works fine when I run the .bat physically,  but as soon as I try to run it inside the Application by either sytem() or LaunchExecutable() the .bat starts up but sais "The system cannot execute the specified program".

0 Kudos
Message 5 of 7
(6,133 Views)
Solution
Accepted by topic author ApeKind

Solved: when running the .exe it needs the full location of both files (c:\...\file.hex and c:\...\file.bin), the hex2bin.exe needs to be in the root file of the application, and the file location needs to have NO spaces

0 Kudos
Message 6 of 7
(6,111 Views)

Thanks ApeKind. This helped my application.. I was looking for something similar.

0 Kudos
Message 7 of 7
(6,103 Views)