|
-
Jan 20th, 2009, 05:46 PM
#10
Junior Member
Re: Automate Command Prompt Window (CMD), Redirect Output to Application [2003/2005]
I solved the clear first problem by changing:
Code:
Private Sub CMDAutomateThread()
txtResults.Text = Results
End Sub
to
Code:
Private Sub UpdateText()
txtResults.AppendText(Results)
txtResults.SelectionStart = txtResults.Text.Length ' this line and the next
txtResults.ScrollToCaret() 'sets the scrollbar to the bottom
End Sub
I also wanted to see the latest data in the textbox, and scroll back to see older data, hence the other two lines of code.
I do not want the cmd window to close, I want it, and 5 others, to stay open. I am adapting this code to open 6 server windows (cmd-like) as part of a GUI for a Virtual World (here is the work-in-progress)
My textboxes should act in the same way as these server (cmd console) windows, i.e. I can see all status messages, and I can enter commands and see the results.
While testing, I will send commands in the way the code in this thread uses, but later I will change it to specific commands behind button clicks, or Menu options.
I am currently working on a way to set a rolling buffer size for the TextBox, so it does not get too big.
Your alternative code in post #14 looks very interesting indeed. I will have a play with that tomorrow.
Rock
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|