home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / tot5.zip / DEMEX1.PAS < prev    next >
Pascal/Delphi Source File  |  1991-02-11  |  1KB  |  40 lines

  1. Program DemoMiscExecOne;
  2. {DEMEX1 - executing other programs from within a Turbo Pascal program}
  3.  
  4. Uses DOS,CRT, totMISC;
  5.  
  6. {IMPORTANT NOTE: you must use the $M compiler directive to instruct the
  7.  compiler to leave some memory for the child process, i.e. leave enough
  8.  memory for the sub-program to run.
  9.  
  10.  $M limits the amount of memory available for the parent program, and 
  11.  the precise settings are therefore dependant upon the program's size.
  12.  You will have to experment with different values -- your goal should be
  13.  to allocate "just enough" memory for the parent program, thereby leaving
  14.  the maximum amount possible for the child program.
  15.  
  16.  Other Toolkit units make extensive use of the heap, and in
  17.  most "real life" program you will need to set the heap to a non-zero 
  18.  value, e.g. $M $8000,$4000,$4000. As a rule, set the min and max values
  19.  the same. Refer to the Turbo Pascal documentation for further information
  20.  regarding the $M compiler directive.
  21.  
  22. }
  23.  
  24. {$M $800,$50,$50}
  25.  
  26. var RetCode : integer;
  27.  
  28. begin
  29.    writeln('This is the parent program!');
  30.    Retcode := RunDOS('Type EXIT to return to the parent program');
  31.    writeln('Welcome back');
  32.    if RetCode <> 0 then
  33.       Writeln('Something went wrong!');
  34.    writeln('Press any key...');
  35.    repeat until keypressed;
  36. end.
  37.  
  38.  
  39.  
  40.