.exe lines

What are the lines of code that let the computer automatically run a program if you rename the file as a .exe file?


re: .exe lines

First of all, the program to be run must truly be an executable program. You can't just rename it with a .exe extension. For a True Basic program, the file must be BOUND to produce an executable file (not sure if you can bind programs with Bronze, but you can with silver and gold versions). You can run other non-TB executables, such as a media player from inside a True Basic program using

CHAIN "!"&"(full path and prgram name).exe"&str$(passing parameter)&" "&str$(passing parameter),RETURN

The full path and program name is important. The passing parameters are optional--and you can pass as many variables from one program to the other using the format above. This is mostly useful for calling one TrueBasic program from another. For example, I have a whole series of short instructional animations--each are bound into a executable. They are kept separate because I can then call individual animations from a Power Point presentation. However, I also have a menu program that displays a set of these animations and allows you to run one or more of your choice. The CHAIN command above is used to call the individual animations and the menu program passes information about the speed of the machine being used so that each individual animation doesn't have to rerun that part of the code.


TB Bronze

Bronze will not BIND (i.e. make an executable). I always enjoy rtarara's comments a lot. Older versions of Silver require runtime DLLs in addition to the *.exe.

Thanks, but...

Thank you for responding, and that will be very helpful with some other tests I was hoping to try, it's just that a very reliable friend of mine said that there were certain code lines that you needed to add to a program to make it and executable file. Then, and only then could you rename it as an executable file, and have it work.

re: .exe programs

Not in True Basic (maybe in C or other languages). To make any TrueBasic program executable (*.exe file) you only need to BIND it (BIND under the RUN menu). It will automatically produce a copy of your program with the .exe extension. If you want to pass variables to your program from another, then there in one additional line--see 'PROGRAM' in the manual.

There are steps that should be taken if you want your executable program to run from any computer no matter where the user stores the program, but these are primarily steps needed if you store files in sub-folders or want the program to run in a network environment. Basically it involves determining the full path to the program at the time of execution and using that path as part of the location of any of your files. There are other things that can become important--like what resolution and color depth the computer is running (important if you are using certain types of graphics), but all of this is more 'advanced' programming techniques.