Can I insert a command line into a win32 application?
On linux and when installing packages, etc. There are several installers that have a progress bar and a dos window that displays the extracted files, etc. How can I add this window to my C ++ Win32 programs so that I can show its tasks that they perform? I can not find the MSDN documentation.
Question How can I add a console window (if this is what caused it, of course, seems to be the same) in my program to show details of the task being performed?
Here is a window with what I ask .. (personal information, so I deleted the details.:]
You cannot embed a real console window in another window (although a window process may have a separate console window). Although it looks like a console window / command line, it is just a matter of appearance. What you want to do is create a sub-window / control with similar characteristics, like a console window, and then redirect the console output from applications launched to add to this sub-window. For more information on how to redirect console output on Windows, see http://support.microsoft.com/kb/190351 .
This "dos window" is a regular control: CreateWindow(ES_MULTILINE, EDIT, ...
However, it has a font set to a fixed width (looks like a courier). This is done by sending WM_SETFONT
to the edit control.
@ user995048 says: "You cannot embed a real console window in another window." But "can not" is a strong word! If I want, I can start the entire virtualized computer in a window. :) So, you can quite reasonably understand that there are ways to do what you say.
Of course, it is true that you almost certainly saw cases of redirecting output to a custom widget designed to simulate the simple appearance of a terminal. However ... if you want to embed one application window inside another, there are things on which you can look at what can fit. Conclusion methods exist as GtkPlug, for example:
http://developer.gnome.org/gtk/2.24/GtkPlug.html
To actually capture a non-collaborative application window and throw it into your application would be more difficult. But perhaps, just like screen shots and virtual machines. It is probably best to avoid this kind of thing if that is not really the reason for this, though ...
Try this http://www.codeguru.com/cpp/misc/misc/article.php/c277/ link. I think the solution provided is what you need. I tried this many years ago and it worked. However, I have not tried it in newer versions of windows.