Implement a Console Window Using Edit Control

A console applicaton, such as a telnet emulator, needs to implement a console window for the user to type commands. It is not that easy to code everything that a text editor does. Windows’ edit control does everything for us, so why do not use it?

The following example indicates how to do this. CConsoleBox derives from CEdit. By customizing several standard behaviors, it works like a console.

Above is a demo to show how to use CConsoleBox. What the user types will be converted to upper case and echoed back at the console.

The user can call back previously typed commands by pressing the Up/Down keys.

Note: Not all “key combinations” and “Windows command messages” are implemented. You need to write your own code to do what you want.

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read