المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : cmd.exe standardinput problem, please help?!?!



C# Programming
05-06-2009, 01:52 PM
I have very weird problem with the windows command prompts standard input.
When i write regular dos command like cd or dir to the input stream everything goes as expected BUT when i want to execute a GUI app (say notepad) the window doesnt show up until i write some empty lines to the stream?http://www.barakasoft.com/script/Forums/Images/smiley_confused.gif


cmd.StandardInput.WriteLine("notepad");
cmd.StandardInput.Flush();
//notepad windows hanst shown up and will not show up untill
//i write empty lines/thrash to the input strem, btu the process notepad.exe is started with memory on ~1300 kb

cmd.StandardInput.WriteLine("blaaaaa");// notepad.exe's mem goes to 2000+ kb
cmd.StandardInput.WriteLine("blaaaaa");// notepad.exe's mem goes to 3000+ kb
cmd.StandardInput.WriteLine("blaaaaa");// and finally notepads window shows up

//allright, the notepad window is up now after i wrote those 3 lines but why is this happning?
//if i want to start visualstudio form cmd by writing to its input stream i have to write 5+ lines to //the stream


Please help..this is so weird, even my friend google couldnt help me http://www.barakasoft.com/script/Forums/Images/smiley_OMG.gif