|
launching an .EXE from pascal?
Author |
Message |
sp33 #1 / 6
|
launching an .EXE from pascal?
can someone help me figure out how to launch an .EXE from a Pascal program and terminate the current application? i'm using some sound and graphics libraries that require application shutdown to flush memory, and i want to have the program be able to switch libraries without the user having to exit and restart. is this feasible? thanks, -tim
|
Wed, 18 Jun 1902 08:00:00 GMT |
|
|
Osmo Ronkan #2 / 6
|
launching an .EXE from pascal?
Quote: >can someone help me figure out how to launch an .EXE from a pascal >program and terminate the current application? >i'm using some sound and graphics libraries that require application >shutdown to flush memory, and i want to have the program be able to >switch libraries without the user having to exit and restart. is this >feasible?
How about using BAT-files? Osmo
|
Wed, 18 Jun 1902 08:00:00 GMT |
|
|
sp33 #3 / 6
|
launching an .EXE from pascal?
Quote:
> >can someone help me figure out how to launch an .EXE from a pascal > >program and terminate the current application? > How about using BAT-files?
i thought about that, but it's not very elegant. i was hoping for something that was more aesthetic from the user's point-of-view. i tried doing: swapvectors; exec('COMMAND.COM','/C FILE.EXE'); swapvectors; (thanks MK) but it does nothing for some reason, whereas elsewhere in the code i do a: swapvectors; exec(fsearch('start.exe',getenv('path')),'http://www.speedstrip.com'); writeln(doserror); swapvectors; to launch a browser to my web page, which works fine. any pascal sleuths out there know how to do it? thanks, tim
|
Wed, 18 Jun 1902 08:00:00 GMT |
|
|
Martin_TV #4 / 6
|
launching an .EXE from pascal?
If your program is in real mode then use the chain utility from Turbopower Software. It can be found at: ftp://ftp.turbopower.com/pub/misc/funcs/chain.lzh If you happen to find a way to do it in protected mode let me know. Martin. * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network * The fastest and easiest way to search and participate in Usenet - Free!
|
Wed, 18 Jun 1902 08:00:00 GMT |
|
|
Osmo Ronkan #5 / 6
|
launching an .EXE from pascal?
Quote:
>> >can someone help me figure out how to launch an .EXE from a pascal >> >program and terminate the current application? >> How about using BAT-files? >i thought about that, but it's not very elegant.
Why is it nor elegant? One uses the tool that is designed for the purpose. Quote: > i was hoping for >something that was more aesthetic from the user's point-of-view.
The user does not have to care if it is a BAT-file or not. Quote: >i tried doing: >swapvectors; >exec('COMMAND.COM','/C FILE.EXE'); >swapvectors; >(thanks MK) >but it does nothing for some reason, whereas elsewhere in the code i do a: > swapvectors; > exec(fsearch('start.exe',getenv('path')),'http://www.speedstrip.com'); > writeln(doserror); > swapvectors; >to launch a browser to my web page, which works fine.
Exec always needs the full path as first parameter. The second is just parameters for the program. You can write any command line after the "/C" (no need to put any extensions etc.) Osmo
|
Wed, 18 Jun 1902 08:00:00 GMT |
|
|
Valentine Mehlin #6 / 6
|
launching an .EXE from pascal?
Tim, There are two ways that I currently launch programs. When the programs to be run may vary over time I use a menu program that runs innside a BATch file. The user never sees that it is a batch file because I run a program which displays a nice menu on the screen. Using either keyboard or mouse, the user selects the program they want and the program exits with a corresponding Dos Error Code. The batch file then runs the chosen program. This method leaves the most memory available for the called program. The second way involves the EXEC command. This example is from a working program: command := ' /C ' + prog_name + ' ' + divsn + ' ' + dvsn_name ; prog_name := 'c:\command.com' ; SwapVectors; Exec(prog_name,Command) ; SwapVectors; It is very important though to do this from a small program which has the folloing line in it: {$M $2000, 0, 0 } { 16K Stack, No Heap } I put this right after my USES section. Expiriment with the Stack & Heap values so you can use the smallest values possible. The more memory you use here, the less your program will have. I hope this helps. Val M. Quote:
> > >can someone help me figure out how to launch an .EXE from a pascal > > >program and terminate the current application? > > How about using BAT-files? > i thought about that, but it's not very elegant. i was hoping for > something that was more aesthetic from the user's point-of-view. > i tried doing: > swapvectors; > exec('COMMAND.COM','/C FILE.EXE'); > swapvectors; > (thanks MK) > but it does nothing for some reason, whereas elsewhere in the code i do a: > swapvectors; > exec(fsearch('start.exe',getenv('path')),'http://www.speedstrip.com'); > writeln(doserror); > swapvectors; > to launch a browser to my web page, which works fine. > any pascal sleuths out there know how to do it? > thanks, > tim
|
Wed, 18 Jun 1902 08:00:00 GMT |
|
|
|