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.


Downloads

Comments

  • Use ?

    Posted by krishnadevan on 06/16/2004 02:20am

    Hi I like it . But what is the use of it ? any commands can be executed .. u have to create some pipes to connect it with comand.. Hopes u will do it

    • This is what I wanted

      Posted by j_sharan on 02/23/2006 02:48pm

      I was looking for a code like this, Thanks shang.

      Reply
    • Program crashed

      Posted by bikejog on 12/16/2004 12:40pm

      Under Windows XP, the supplied .exe crashed if I presses the UP Arrow repeadily. Just launch application then press the UP Arrow Key repeadily. It crashes.

      Reply
    • Useful

      Posted by iamahorse on 09/21/2004 09:43pm

      I just want this.

      Reply
    • Demo has no use

      Posted by shallyee on 06/19/2004 09:29am

      The demo has no use, just hint. If you are writing something like telnet emulator, command base calculator, etc, the class may help you.

      Reply
    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • You probably have several goals for your patient portal of choice. Is "community" one of them? With a bevy of vendors offering portal solutions, it can be challenging for a hospital to know where to start. Fortunately, YourCareCommunity helps ease the decision-making process. Read this white paper to learn more. "3 Ways Clinicians can Leverage a Patient Portal to Craft a Healthcare Community" is a published document owned by www.medhost.com

  • When it comes to desktops – physical or virtual – it's all about the applications. Cloud-hosted virtual desktops are growing fast because you get local data center-class security and 24x7 access with the complete personalization and flexibility of your own desktop. Organizations make five common mistakes when it comes to planning and implementing their application management strategy. This eBook tells you what they are and how to avoid them, and offers real-life case studies on customers who didn't let …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds