QuickWin - Console Application Into a Window | CodeGuru

QuickWin – Console Application Into a Window

Introduction QuickWin is a window application that spawn a Win32 console application redirecting his stdin, stdout and stderr handles to a window. The console application is hiding and all I/O operations are made through QuickWin. This is a very useful program to spawn script programs or console applications in a window environment without opening a […]

Written By
CodeGuru Staff
CodeGuru Staff
Oct 1, 2002
2 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

Introduction

QuickWin is a window application that spawn a Win32 console application redirecting his
stdin, stdout and stderr handles to a window. The console application is hiding and all
I/O operations are made through QuickWin.

This is a very useful program to spawn script programs or console applications in a
window environment without opening a DOS box.

How QuickWin works

QuickWin contains one or two windows depending if you want the same stdout view for stderr
output or another view. Stdin is in the same view as stdout. The view is a CRichEditView
and is not limited in space for the Output. Command like cut, copy, paste, find are also
available. QuickView can spawn console applications, shell (COMMAND.COM or CMD.EXE) or batch
files. You start the console application from command line or browse your disk. You can also
stop and restart the console application many times. The content of the output view can be saved
into file. The last 10 programs are saved into the registry and available for quick start.

The following parameters are available:

Full or Half duplex.

In full duplex, characters are send to stdin and displayed into the view. In half duplex, they
are only send to stdin.

Advertisement

Enter.

The enter key (CR) can be translated into CR, LF or CR+LF.

Close on Exit.

If the console application is terminated, QuickWin will terminate.

Show Child window.

You can display the DOS box child window. If you want to write into this “Console”, open
the “CON” file and write into it.

Oem -> Ansi.

Normally, we must translate characters for console application.

Use Input buffer.

If it is not necessary to send each character, one at a time to the stdin, character can be
written into an input buffer until CR is pressed.

Command line.

For COMMAND.COM or CMD.EXE, the command is echoed to stdout. This option
removes the tipped command.

Options for COMMAND.COM or CMD.EXE.

Full duplex, CR->CR+LF, Oem->ANSI, Use input buffer and Command line.

For standard applications, remove the Command line option.

Main interest in source code

A CRedirect class that can be used in any WIN32 or MFC applications. This class contains
four virtual functions for notification.

virtual void OnChildStarted(LPCSTR lpszCmdLine);
virtual void OnChildStdOutWrite(LPCSTR lpszOutput);
virtual void OnChildStdErrWrite(LPCSTR lpszOutput);
virtual void OnChildTerminate();

The main program is an MFC application that use the CRedirect class.


PostThreadMessage to post command in multithread environment.


WM_COPYDATA to post message to window.

The MFC print preview bug is not corrected!

Thanks to Paul DiLascia for some pieces of code from TraceWin.

Downloads

Download QuickWin application – 34 Kb

Download source and demo project – 107 Kb

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.