Skip to content

Console

Gratt-5r2 edited this page Apr 9, 2022 · 5 revisions

class CConsole

Allow to print messages to the default output device.

static void Show() - show console window
static void Hide() - hide console window
static void Release() - release console window
static void Clear() - clear console window
static HANDLE GetHandle() - returns std handle
CCmd& Print( const CStringA& str, const CPID& cp = ANSI_CODEPAGE_CYRILLIC ) - print ANSI text
CCmd& Print( const CStringW& str ) - print UNICODE text
CCmd& Print( const text str, const CPID& cp = ANSI_CODEPAGE_CYRILLIC ) - print char* text
CCmd& Print( const wtext str ) - print wchar_t* text
CCmd& operator << ( any ptr ) - print object

enum ECmdColorID

CMD_BLACK - black text color.
CMD_BLUE - dark blue text color.
CMD_GREEN - dark green text color.
CMD_CYAN - dark cyan text color.
CMD_RED - dark red text color.
CMD_PURPLE - dark purple text color.
CMD_YELLOW - dark yellow text color.
CMD_WHITE - gray text color.
CMD_INTENSITY or CMD_INT - flag to set color as bright.
CMD_BLACK_INT - dark gray text color.
CMD_BLUE_INT - bright blue text color.
CMD_GREEN_INT - bright green text color.
CMD_CYAN_INT - bright cyan text color.
CMD_RED_INT - bright red text color.
CMD_PURPLE_INT - bright purple text color.
CMD_YELLOW_INT - bright yellow text color.
CMD_WHITE_INT - white text color.
CMD_RESET - reset color to default

Example:

cmd << CMD_GREEN_INT << "success" << CMD_RESET << endl;

struct Col16

Col16(front = CMD_WHITE, back = CMD_BLACK) - color descriptor where front is a text color and back is a background color.

Example:

cmd << Col16( CMD_WHITE_INT, CMD_RED ) << "critical error!" << Col16() << endl;

variable cmd

Is the default Union console object.

function endl

Is the default Union line break function.

function tab

Is the default Union tabulation function.

example

in:

cmd << 200 << tab << "Golden Nuggets" << endl << 5 << tab << "rusty swords";

out:

200    Golden Nuggets
5      rusty swords
Clone this wiki locally