Comments are available to members only. Sign up or Log in to view these comments.
Main Topics
Browse All TopicsI need to know how to programmatically close an MS-DOS window via VB 6.0 (SP4).
The DOS window is opened using the CreatProcess API, so I have access to the Process Handle, Process ID, Thread Handle, and Thread ID of the window... I can also fairly easily find the MS-DOS window's handle. This DOS window contains an ongoing and continuing program that can NOT be shut down from within the program... it has to be done either by manually right clicking on the minimized DOS window and selecing CLOSE... the selecting YES from the warning dialog (very tacky way to do it), or by programmatically forcing it down. The problem is HOW?
Here are options that I've tried and WON'T work in this case:
- Starting the program using the Shell("Command.com /C <PROGRAM>") call
- Finding the handle of the MS-DOS window and sending a WM_CLOSE message to it via either the SendMessage or PostMessage API
- Sending a <CTRL> + C key command to the window
- Sending an <ALT> + F4 key command to the window
I tried using the ExitProcess and ExitThread API calls, but they didn't work. ExitProcess closed down the VB IDE (I guess because they are in the same process?) but didn't close the MS-DOS window.
Anyone a guru on MS-DOS consoles that can provide a little help? =)
HATCHET
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: WoodersonPosted on 2000-08-30 at 15:55:21ID: 4135017
Comments are available to members only. Sign up or Log in to view these comments.