ExecFile Q

BlitzPlus Forums/BlitzPlus Programming/ExecFile Q

Adam Novagen(Posted 2006) [#1]
I've been wondering something: as far as I know, ExecFile can only run .EXEs that are self-contained, so no loaded images, no programs like MS Word, etc. Is there ANY way to execute programs that use external files? (I use windows 98/2000/XP, if that helps.)


Zethrax(Posted 2006) [#2]
Execfile just runs the program. The program being run will load its own images and other external resources as it would if you opened the file by double clicking on its icon, etc.

Note that it is a good idea to wrap the filepath of the program being run in double quotes (Chr$( 34 )) as spaces in the string can cause problems otherwise.

eg.

ExecFile Chr$( 34 ) + "C:\Program Files\Blitz3D\bin\blitzcc.exe" + Chr$( 34 )

You can also include command line data following the filepath of the program being run. The program can then access that data through its command line interface (in Blitz you would access it using the CommandLine$() command). Each item of data should be separated by a space character. If a data item itself contains spaces, then you should wrap the data item in double quotes.

Most programs that load and process files expect that the first data item is the path to the file to be opened.

eg.

ExecFile Chr$( 34 ) + "C:\Program Files\Internet Explorer\iexplore.exe" + Chr$( 34 ) + " " + Chr$( 34 ) + "http://www.brightrealm.com/" + Chr$( 34 )

End