Win32 console
Encyclopedia
Win32 console is a text user interface
Text user interface
TUI short for: Text User Interface or Textual User Interface , is a retronym that was coined sometime after the invention of graphical user interfaces, to distinguish them from text-based user interfaces...

 implementation within the system of Windows API
Windows API
The Windows API, informally WinAPI, is Microsoft's core set of application programming interfaces available in the Microsoft Windows operating systems. It was formerly called the Win32 API; however, the name "Windows API" more accurately reflects its roots in 16-bit Windows and its support on...

, which runs console application
Console application
A console application is a computer program designed to be used via a text-only computer interface, such as a text terminal, the command line interface of some operating systems or the text-based interface included with most Graphical User Interface operating systems, such as the Win32 console in...

s. A Win32 console has a screen buffer
Screen buffer
In computing, screen buffer is a part of computer memory used by a computer application for the representation of the content to be shown on the computer display....

 and an input buffer, and is available both as a window
Window (computing)
In computing, a window is a visual area containing some kind of user interface. It usually has a rectangular shape that can overlap with the area of other windows...

 or in text mode
Text mode
Text mode is a kind of computer display mode in which the content of the screen is internally represented in terms of characters rather than individual pixels. Typically, the screen consists of a uniform rectangular grid of character cells, each of which contains one of the characters of a...

 screen, with switching back and forth available via Alt-Enter keys.

Win32 consoles are typically used for applications that do not need to display images (but sometimes use color). Examples include command line interface tools such as command line interpreters (e.g., CMD.EXE, Windows PowerShell
Windows PowerShell
Windows PowerShell is Microsoft's task automation framework, consisting of a command-line shell and associated scripting language built on top of, and integrated with the .NET Framework...

, Korn shell
Korn shell
The Korn shell is a Unix shell which was developed by David Korn in the early 1980s and announced at USENIX on July 14, 1983. Other early contributors were AT&T Bell Labs developers Mike Veach, who wrote the emacs code, and Pat Sullivan, who wrote the vi code...

) or text interface applications such as some file manager
File manager
A file manager or file browser is a computer program that provides a user interface to work with file systems. The most common operations performed on files or groups of files are: create, open, edit, view, print, play, rename, move, copy, delete, search/find, and modify file attributes, properties...

s and text editor
Text editor
A text editor is a type of program used for editing plain text files.Text editors are often provided with operating systems or software development packages, and can be used to change configuration files and programming language source code....

s (e.g. Far Manager
FAR Manager
FAR Manager is an orthodox file manager for Microsoft Windows and a clone of Norton Commander...

, Midnight Commander
Midnight Commander
GNU Midnight Commander is a free cross-platform orthodox file manager and a clone of Norton Commander originally created by Miguel de Icaza.Midnight Commander is licensed under the terms of the GNU General Public License.-Design:...

, MS-DOS Editor).

Details

The input buffer is a queue where events are stored (from keyboard
Computer keyboard
In computing, a keyboard is a typewriter-style keyboard, which uses an arrangement of buttons or keys, to act as mechanical levers or electronic switches...

, mouse etc.). The output buffer is a rectangular grid where characters are stored, together with their attributes. A console window may have several output buffers, only one of which is active (i.e. displayed) for a given moment.

The console window may be displayed as a normal window on the desktop, or may be switched to full screen to use the actual hardware text mode
Text mode
Text mode is a kind of computer display mode in which the content of the screen is internally represented in terms of characters rather than individual pixels. Typically, the screen consists of a uniform rectangular grid of character cells, each of which contains one of the characters of a...

, if a video driver permits a chosen screen size. Unfortunately, the display mode is locked in background intensity mode, thus blinking does not work. Also, the underscore attribute is not available.

Programs may access a Win32 console either via high-level functions (such as ReadConsole and WriteConsole) or via low-level functions (e.g. ReadConsoleInput and WriteConsoleOutput). These high-level functions are more limited than a Win32 GUI
Gui
Gui or guee is a generic term to refer to grilled dishes in Korean cuisine. These most commonly have meat or fish as their primary ingredient, but may in some cases also comprise grilled vegetables or other vegetarian ingredients. The term derives from the verb, "gupda" in Korean, which literally...

; for instance it is not possible for a program to change the color palette, nor is it possible to modify the font
Font
In typography, a font is traditionally defined as a quantity of sorts composing a complete character set of a single size and style of a particular typeface...

 used by the console using these functions.

Win32 console applications are often mistaken for MS-DOS
MS-DOS
MS-DOS is an operating system for x86-based personal computers. It was the most commonly used member of the DOS family of operating systems, and was the main operating system for IBM PC compatible personal computers during the 1980s to the mid 1990s, until it was gradually superseded by operating...

 applications, especially on Windows 9x
Windows 9x
Windows 9x is a generic term referring to a series of Microsoft Windows computer operating systems produced since 1995, which were based on the original and later modified Windows 95 kernel...

 and Windows Me
Windows Me
Windows Millennium Edition, or Windows Me , is a graphical operating system released on September 14, 2000 by Microsoft, and was the last operating system released in the Windows 9x series. Support for Windows Me ended on July 11, 2006....

. However, a Win32 Console application is, virtually, just a special form of a native Win32 application. Indeed, 32-bit Windows can run MS-DOS
MS-DOS
MS-DOS is an operating system for x86-based personal computers. It was the most commonly used member of the DOS family of operating systems, and was the main operating system for IBM PC compatible personal computers during the 1980s to the mid 1990s, until it was gradually superseded by operating...

 programs in Win32 console through the use of the NT Virtual DOS Machine
Virtual DOS machine
Virtual DOS machine is Microsoft's technology that allows running legacy DOS and 16-bit Windows programs on Intel 80386 or higher computers when there is already another operating system running and controlling the hardware.-Overview:...

 (NTVDM).

In earlier versions of Windows, there was no native support for consoles. Since Windows 3.1 and earlier was merely a graphical interface for MS-DOS, most text applications that ran on earlier Windows versions were actually MS-DOS applications running in "DOS boxes". To simplify the task of porting applications to Windows, early versions of Visual C++
Visual C++
Microsoft Visual C++ is a commercial , integrated development environment product from Microsoft for the C, C++, and C++/CLI programming languages...

 were supplied with QuickWin
QuickWin
QuickWin was a library from Microsoft that made it possible to compile command line MS-DOS programs as Windows 3.1 applications, displaying their output in a window....

, a library that implemented basic console functionality inside a regular Window (a similar library for Borland C++ was called EasyWin).

Windows 9x and Me

Windows 95/98/Me support is relatively poor compared to Windows NT
Windows NT
Windows NT is a family of operating systems produced by Microsoft, the first version of which was released in July 1993. It was a powerful high-level-language-based, processor-independent, multiprocessing, multiuser operating system with features comparable to Unix. It was intended to complement...

, because the console window runs in the system virtual DOS machine
Virtual DOS machine
Virtual DOS machine is Microsoft's technology that allows running legacy DOS and 16-bit Windows programs on Intel 80386 or higher computers when there is already another operating system running and controlling the hardware.-Overview:...

 and so keyboard input to a Win32 console application had to be directed to it by conagent.exe running in a DOS VM that are also used for real DOS applications by hooking the keyboard interrupt. conagent.exe then calls Vcond (which is a VxD
VxD
VxD is the device driver model used in Microsoft Windows/386, the 386 enhanced mode of Windows 3.x, Windows 9x, and to some extend also by the Novell DOS 7, OpenDOS 7.01, and DR-DOS 7.02 multitasker...

). Vcond then had to pass the keyboard input to the System VM, and then finally to the Win32 console application.
Besides performance, another problem with this implementation is that drives that are local to a DOS VM are not visible to a Win32 console application. This can cause confusion.

Under Windows 95/98/Me, the screen buffer mirrors the structure of VGA text buffer
VGA compatible text mode
The implementation of computer monitor text mode on VGA compatible hardware is quite complex. Its use on PC compatible computers was widespread in 1980s–1990s , but persists today for some applications even on modern desktop computers...

, with two bytes per character cell: one byte for character code, one byte for attributes (the character must be in OEM character set, the attribute is with high-intensity background/no blinking). This speeds up operation considerably if the actual VGA text mode is used.

Windows NT and CE based

The Client/Server Runtime Subsystem is responsible for Win32 console windows on Windows NT based operating systems.

Under Windows NT and CE based versions of Windows, the screen buffer uses four bytes per character cell: two bytes for character code, two bytes for attributes. The character is then encoded a 16-bit subset of Unicode
Unicode
Unicode is a computing industry standard for the consistent encoding, representation and handling of text expressed in most of the world's writing systems...

 (UCS-2). For backward compatibility, the console APIs exist in two versions: Unicode and non-Unicode. The non-Unicode versions of APIs can use code page
Code page
Code page is another term for character encoding. It consists of a table of values that describes the character set for a particular language. The term code page originated from IBM's EBCDIC-based mainframe systems, but many vendors use this term including Microsoft, SAP, and Oracle Corporation...

 switching to extend the range of displayed characters (but only if TrueType
TrueType
TrueType is an outline font standard originally developed by Apple Computer in the late 1980s as a competitor to Adobe's Type 1 fonts used in PostScript...

 fonts are used for the console window, thereby extending the range of codes available). Even UTF-8
UTF-8
UTF-8 is a multibyte character encoding for Unicode. Like UTF-16 and UTF-32, UTF-8 can represent every character in the Unicode character set. Unlike them, it is backward-compatible with ASCII and avoids the complications of endianness and byte order marks...

 is available as "code page 65001".

See also

  • Command line interface
  • Shell (computing)
    Shell (computing)
    A shell is a piece of software that provides an interface for users of an operating system which provides access to the services of a kernel. However, the term is also applied very loosely to applications and may include any software that is "built around" a particular component, such as web...

  • System console
    System console
    The system console, root console or simply console is the text entry and display device for system administration messages, particularly those from the BIOS or boot loader, the kernel, from the init system and from the system logger...

  • Linux console
    Linux console
    The Linux console is a system console support in the Linux kernel. The Linux console was the first functionality of the kernel, developed as early as in 1991 . On PC architecture, it is common to use VGA-compatible video hardware. Implementations of computer graphics on Linux are excluded from the...

  • Text-based (computing)

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK