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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Programmatic Pasting into a Dos-Box

Status
Not open for further replies.

colttaylor

Programmer
Aug 20, 2002
117
US
Hi,
I'm trying to send a series of keystrokes into a dos application programmatically. My current technique involves running my dos application in a non-full-screen dos box and then loading the keystrokes into the clipboard. This is working properly such that when I click on the system menu of the dos box and select Edit/Paste, the keystrokes stream into my application just like I want them too.
Now I am trying to eliminate the need for manually clicking the system menu/edit/paste with the mouse.
I have posted a WM_Paste message to the handle of the dos box, but this doesn't do anything.
I think I need to post a WM_SystemMenu message followed by the WM_Keydown/WM_Keyup messages for the "E" and the "P", but when I just sen the WM_SystemMenu message, the system menu doesn't appear over the dos-box, so my confidence in this approach is low.
While I am coding the rest of this low-confidence attempt, I thought I might beg for help from the guru's of the WinAPI forum...
Anyone know how to do what I'm trying to do?
Thanks in advance!
Peace,
Colt. If it's stupid but it works, it isn't stupid
 

Check out the sendmessage API. You may also need enumwindows API.

Good Luck

 
Thanks for the reply, but how would I use enumwindows...?
I already have the handle of the dos box since I shellexec'd it into existence. Do you think that there is more than one windows handle associated with each instance of dos box? Interesting...

Let me open up the scale of my original question.
Does anyone know where technical information about the windows dos box and its interactions with the windows operating system can be found?

Thanks for the reply and thanks for any future help!
Peace,
Colt If it's stupid but it works, it isn't stupid
 
What is the source of your data? i.e Are you writing a C++ program, a VB program, a VB.NET program, a Java program, or what?
 
I'm coding in Delphi right now, but can switch to C++ if needed. This project falls into the category of a temporary fix to keep an old dos product functioning while I do a full rewrite in C#.net.
What I need is a Win API best practices on streaming keystrokes into a dos box. Loading the clipboard with text and then pasting it is just my current approach.
Thanks for any future assistance,
Colt. If it's stupid but it works, it isn't stupid
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top