Forcing a DOS window created by CreateProcess() to close.

Hi. Me Again :). I am looking for a way to force a DOS window created with a CreateProcess() to close automatically when the program is finished. I want the program to automatically run a DOS program (PKZIP.EXE), wait for completion of it, and then automatically continue when it is finished. The program runs the program for me, but after PKZIP is finished the window title changes to PKZIP-finished and it stays open until I close it manually. Then the VB program continues on running like it should. I have tried putting a _default.pif file in the C:WINDOWS directory with the proper settings, to no avail. Any ideas, anyone? Thanks again.


  • Find PKZip.exe itself on your computer. Right-click and select properties. Click the tab labeled program and make sure "close on exit" is checked. If it is, I can't help you. If it isn't, this should make it work. I believe the pif file should be placed in windowspif not just windows.

    Or, if the dos box remains in focus at the end, you can always use Sendkeys to send Alt-Space, C to the box. This will close it.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!