Sending Control-C to DOS app 
Author Message
 Sending Control-C to DOS app

is there any way to send a Control-C to a DOS window? I have tried
PostMessage hwnd, WM_CLOSE, 0&, ByVal 0& but that brings up another dialog
telling me I should close the program by it's own means, which is Control-C
when the window is active.

Thanks,

Bob Hiller



Mon, 08 Sep 2003 03:31:20 GMT  
 Sending Control-C to DOS app
Bob,

Quote:
>is there any way to send a Control-C to a DOS window?

I believe you're looking for the GenerateConsoleCtrlEvent API.

Matt

====================================

http://www.msjogren.net/dotnet/

CodeHound - The Software Developer's Search Engine
http://www.codehound.com



Mon, 08 Sep 2003 06:15:32 GMT  
 Sending Control-C to DOS app
Mattias, do you have an example of using this API? I have searched the web
and cannot find a working sample.

Here is what I currently do:
1 Shell C++ console app #1 and run it hidden
2 Wait 2 secs
3 Shell C++ console app #2 and run it hidden
4 Wait 2 secs
5 Shell C++ console app #3 and run it hidden
6 Wait 2 secs
7 Shell C++ console app #4 and run it hidden

What I need to do is send a Control-C to each app in reverse order:

send Control-C to app #4
send Control-C to app #3
send Control-C to app #2
send Control-C to app #1

Any Idea's?

Thanks,

Bob Hiller


Quote:
> is there any way to send a Control-C to a DOS window? I have tried
> PostMessage hwnd, WM_CLOSE, 0&, ByVal 0& but that brings up another dialog
> telling me I should close the program by it's own means, which is
Control-C
> when the window is active.

> Thanks,

> Bob Hiller



Tue, 09 Sep 2003 00:37:39 GMT  
 Sending Control-C to DOS app
Bob,

Quote:
>Mattias, do you have an example of using this API?

No sorry, I don't. And after doing some more reading, I think it's not
quite as easy as I thought it would be. This article covers it all
very well:

http://msdn.microsoft.com/library/periodic/period98/win320698.htm

Matt

====================================



Tue, 09 Sep 2003 23:49:05 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. How to sent a keystroke to a dos-app started with the shell function in vb6

2. sending keys from VB to dos APP

3. Sending Key Strokes to Hidden DOS apps

4. Sending Characters to a DOS App

5. Help with sending function keys and cursor keys to DOS app

6. Help send Alt-Z to a DOS app from VB32

7. Sending Keys To Dos Apps

8. Send keystrokes to DOS app?

9. Sending DOS app some menu commands

10. Why can't program send keys to a dos shelled app

11. VB5 controlling DOS-Apps, any ideas

12. Using Shell, AppActivate and Sendkeys to control DOS app from VB

 

 
Powered by phpBB® Forum Software