Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to embed a command prompt in a win32 app?

In linux and when installing packages etc. There are some installers that have a progress bar and a dos window which shows the files being extracted etc. How can i add this window to my C++ Win32 programs so that i can have it showing the tasks im doing? I cannot find any documentation on MSDN.

Question: How can i add a console window (if that's what its called, sure looks like one) in my program to show the details of the task at hand being done?

Here is a window with what i am asking.. (personal info so I erased the details. :]

enter image description here

like image 564
iKlsR Avatar asked Oct 18 '11 05:10

iKlsR


2 Answers

You cannot embed a real console window inside another window (although a windowed process can have a separate console window). While it looks like a console window / command prompt, it is just a matter of appearances. What you want to do is create a sub-window/control with similar characteristics as a console window and then redirect the console output from the application(s) being run to append to that sub-window. For more information on how to do redirect the console output in Windows, see http://support.microsoft.com/kb/190351.

like image 55
user995048 Avatar answered Sep 18 '22 23:09

user995048


That "dos window" is a regular edit control: CreateWindow(ES_MULTILINE, EDIT, ... However, it has the font set to a fixed-width one (Looks like courier). This is done by sending WM_SETFONT to the edit control.

like image 26
MSalters Avatar answered Sep 20 '22 23:09

MSalters