08-17-2011 10:29 AM
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
Solved! Go to Solution.
08-17-2011 11:04 AM
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
08-18-2011 02:46 AM
Thanks Judy for the response. I will give that a whirl and see what I get.
Cheers
08-18-2011 03:04 AM
Have just tried that method but unfortunately no luck....any other suggestions?
08-18-2011 03:52 AM
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".
08-22-2011 03:18 AM
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
08-22-2011 08:13 AM
Thanks ApeKind. This helped my application.. I was looking for something similar.