Im using Window XP. If I click on cmd.exe that is in the windows file directory a console window will open up and will stay open until I close it. Im making a program that will open up a console application such as cmd.exe but the console window wont show up when it is exectued from within my program. It just flashes breifly. How can i get it to show up when I execute it from my application?
Posted on 2006-01-13 18:33:16 by tremors
Is your app a DOS app or a WIN32-console app?
Posted on 2006-01-13 19:45:48 by ti_mo_n
Posted on 2006-01-13 20:11:05 by XCHG
ti_mo_n my main app is win32 with gui. the program i excute is a win32 console.

Thanks XCHG, thats exactly what I needed. I appreciate the souce code too.
Posted on 2006-01-14 06:36:13 by tremors
I've been trying to figure out how to send additional commands to the cmd.exe console after it is opened. ShellExecute allows me to send an inital command when I use it but how about communication both ways afterwards? Most importantly right now for me is to find out how to get the text that is displayed in the console window so I can display it in an edit box in my main app for now.
Posted on 2006-01-14 13:18:03 by tremors
You could use a pipe. See Iczelion tutorial number 21 http://win32assembly.online.fr/tut21.html
Posted on 2006-01-14 18:28:11 by stormix

Posted on 2006-01-14 20:50:12 by XCHG
DON'T use command.com, on NT systems it will cause the WOW subsystem to be loaded; slow and unnecessary. Use the %COMSPEC% environment variable instead, if you insist on executing shell commands.

Also, using pipes (as Stormix recommended) is more reliable than redirecting output to a file.
Posted on 2006-01-15 12:29:00 by f0dder