Board index » delphi » Exec'ing dos programs without dos box

Exec'ing dos programs without dos box

I have a small dos utility which I would like to exec from a
windows/delphi program without flashing the dos screen.  The program
does no screen output and takes no console input, but windows still
opens a dos session while it is running.  Is there a way around this?

TIA

If possible, please mail response also.
rcas...@reell.com

 

Re:Exec'ing dos programs without dos box


HI there,

Quote
>I have a small dos utility which I would like to exec from a
>windows/delphi program without flashing the dos screen.  The program
>does no screen output and takes no console input, but windows still
>opens a dos session while it is running.  Is there a way around this?

Two things:

  1) If you have the code to the DOS app, try porting it to Delphi. Just
remember to remove references to the FORMS unit and other VCL stuff and the
application should be about the same size...

  2) If you are doing this in Windows 3.1, the following trick works:

   - create a PIF file for the DOS app. Set all appropriate Memory settings
     etc.
   - in the PIF, make sure you have:
        1) Run Windowed CHECKED
        2) Close on exit CHECKED
        3) Background processing CHECKED
   - if you do not "hard-code" the full path of the EXE within the PIF, then
     you will have to remember to change the PATH BEFORE executing the PIF
   - With this all set, execute the app from delphi as such:

     { change to PATH of PIF/EXE here }

      WinExec('mydosapp.pif',sw_Hide);

     { reset PATH to original if you want }

NOTES:
   - The above command runs the DOS app HIDDEN - i.e. NO WINDOW so if it
     hangs or requires input, the program will get stuck.  A HIDDEN WINDOW
     DOES NOT SHOW UP ON A TASK LIST. A better idea is to set the
     sw_ShowMinimized flag for WinExec...
   - This works fine in Win95 BUT the new DOS is much more integrated into
     Windows so you could presumably skip the PIF altogether??

Hope this helps...

Cheers,
George.---

Re:Exec'ing dos programs without dos box


Quote
rcas...@reell.com (Randy Castle) wrote:
>I have a small dos utility which I would like to exec from a
>windows/delphi program without flashing the dos screen.  The program
>does no screen output and takes no console input, but windows still
>opens a dos session while it is running.  Is there a way around this?

To my knowledge there is no  way aroung opening a DOS session.
But there is a way aroung flashing the DOS screen, if you use WinExec and set the appropriate ShowWindow flag.

Gruss

Dietrich Delekat

Other Threads