Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing a DOS box from VB

Status
Not open for further replies.

epmm001

Programmer
Nov 11, 1998
5
0
0
AU
Who knows how to close a DOS minimised no focus window, from a running VB app. I have used everything from AppActivate and SendKeys to APIs such as FindWindow, DestroyWindow. One of the problems I have is that the DOS window title goes from xxx to "Finished - xxx" . This seems to upset the Hwnd.
 
You might try setting the "Close on exit" property of the DOS window. To do so: Open a new DOS window, click on the properties button, then on the Program tab place a check in the "Close on Exit" checkbox.
 
here is one way of doing it <br>
here is a previous thread 2 days ago<br>
Look at the bottom of this thread by Eric<br>
<br>
<A HREF=" TARGET="_new"><br>
<br>
<p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
A couple of ways...<br>
1) With explorer, find command.com (cmd.exe on NT). (Type 'echo %COMSPEC%' at an MSDOS prompt to find the one it will use.) From explorer, right click on it and set the close on exit check box. save and exit.<br>
<br>
2) Launch the batch file with the /C (run command and exit)switch:<br>
on NT, CMD.EXE /C MYBATCH.BAT<br>
on W9x, COMMAND.COM /C MYBATCH.BAT<br>
Though, there is a COMMAND.COM on NT, it doesn't work very well in this case (at least not from VB). A lot of strange side effects.<br>
<br>
#2 was on MSDN, but I could not find the reference to leave the link here.<br>
<br>
Good Luck!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top