jorge Posted May 11, 2005 Posted May 11, 2005 (edited) interface to cmd.exe Hey all, I'm trying to start and Application that opens the cmd.exe (hidden) and write and read from it. so far I seem to have fingered out the writing part! but reading the output and also the code to hide it doesn't work. can someone help with this (include is my test project I'm using for this) thanx in advanceApacheCompiler.zip Edited May 11, 2005 by jorge Quote Jorge - http://www.blackdot.be/?page=apache.htm
jorge Posted May 12, 2005 Author Posted May 12, 2005 hmmz no one seems to know... o well pitty Quote Jorge - http://www.blackdot.be/?page=apache.htm
Administrators PlausiblyDamp Posted May 12, 2005 Administrators Posted May 12, 2005 Not sure about the why the cmd.exe is not being hidden but you will have problems trying to get the output from the cmd.exe. The problem is that the Readxxx methods will hang until there is something to read and block the execution of your main application. You will need to launch cmd.exe in it's own thread and get it to raise an event back to the main app when it receives data. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
jorge Posted May 12, 2005 Author Posted May 12, 2005 (edited) ok now knowing what the problem was that it waits for input if there is none i fixed it by adding it to a thread :) but now i hit a new problem... when the textbox's max lenght is reached no text can be appended! so how can i remove some text from the top to make the new text fit? Edited May 12, 2005 by jorge Quote Jorge - http://www.blackdot.be/?page=apache.htm
Napivo1972 Posted May 13, 2005 Posted May 13, 2005 I can�t claim to be the world�s greatest programmer but I would store the output in a string or stringbuilder and copy the amount of data I want counting from the end to the textbox Sorry, I don�t know how much data can be stored in a textbox. Quote
jorge Posted May 13, 2005 Author Posted May 13, 2005 I can�t claim to be the world�s greatest programmer but I would store the output in a string or stringbuilder and copy the amount of data I want counting from the end to the textbox Sorry, I don�t know how much data can be stored in a textbox. maybe i'll go for a rtf, i do'nt think it has a limit. becouse i ahve no idea what a stringbuilder is. Quote Jorge - http://www.blackdot.be/?page=apache.htm
Diesel Posted May 13, 2005 Posted May 13, 2005 Add CreateNoWindow = True to the startInfo object. Also, call Peek instead of Read or ReadLine from the standard output stream, otherwise the process wont realize it is waiting for input. Quote
jorge Posted May 15, 2005 Author Posted May 15, 2005 thanx i'll ive it a go Quote Jorge - http://www.blackdot.be/?page=apache.htm
jorge Posted May 15, 2005 Author Posted May 15, 2005 this still leave the problem of the textbox that runs out of space! Quote Jorge - http://www.blackdot.be/?page=apache.htm
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.