Difference between revisions of "Unit Console"

From Ultibo.org
Jump to: navigation, search
Line 878: Line 878:
 
| Cursor Visible On/Off (CONSOLE_MODE_CHARACTER only)
 
| Cursor Visible On/Off (CONSOLE_MODE_CHARACTER only)
 
|-
 
|-
| <code>CursorChars:array of Char;</code>
+
| <code>CursorChars:PChar;</code>
 
| Buffer for cursor characters (CONSOLE_MODE_CHARACTER only)
 
| Buffer for cursor characters (CONSOLE_MODE_CHARACTER only)
 
|-
 
|-
| <code>CursorBuffer:array of Char;</code>
+
| <code>CursorBuffer:PChar;</code>
 
| Buffer for characters currently under cursor (CONSOLE_MODE_CHARACTER only)
 
| Buffer for characters currently under cursor (CONSOLE_MODE_CHARACTER only)
 
|-
 
|-

Revision as of 04:48, 21 June 2023

Return to Unit Reference


Description


Ultibo Console Interface unit

Note:

Console coordinates X,Y are based on either pixels or characters depending on the console mode (Pixel or Character)

Console coordinates begin at 0,0 and extend to Width - 1, Height - 1

Console Window coordinates X,Y are always based on characters, beginning at 1,1 and extending to Cols,Rows

Constants



Console specific constants CONSOLE_*
CONSOLE_NAME_PREFIX = 'Console'; Name prefix for Console Devices


Console device type CONSOLE_TYPE_*
CONSOLE_TYPE_NONE = 0;  
CONSOLE_TYPE_FRAMEBUFFER = 1;  
CONSOLE_TYPE_SERIAL = 2;  
CONSOLE_TYPE_REMOTE = 3;  
CONSOLE_TYPE_LCD = 4;  
 
CONSOLE_TYPE_MAX = 4;  


Console device state CONSOLE_STATE_*
CONSOLE_STATE_CLOSED = 0;  
CONSOLE_STATE_OPEN = 1;  
 
CONSOLE_STATE_MAX = 1;  


Console device flag CONSOLE_FLAG_*
CONSOLE_FLAG_NONE = $00000000;  
CONSOLE_FLAG_LINE_WRAP = $00000001; Wrap long lines to the next line if set
CONSOLE_FLAG_DMA_BOX = $00000002; Use DMA to draw boxes (Where applicable)
CONSOLE_FLAG_DMA_LINE = $00000004; Use DMA to draw lines (Where applicable)
CONSOLE_FLAG_DMA_FILL = $00000008; Use DMA to fill blocks (Where applicable)
CONSOLE_FLAG_DMA_CLEAR = $00000010; Use DMA to clear blocks (Where applicable)
CONSOLE_FLAG_DMA_SCROLL = $00000020; Use DMA to scroll blocks (Where applicable)
CONSOLE_FLAG_SINGLE_WINDOW = $00000040; Console supports only one window (Not multiple)
CONSOLE_FLAG_HARDWARE_CURSOR = $00000080; Console supports a hardware cursor (Mouse pointer) (Character mode only)
CONSOLE_FLAG_HARDWARE_CARET = $00000100; Console supports a hardware caret (Text cursor)
CONSOLE_FLAG_BLINK_CARET = $00000200; Console supports blinking caret
CONSOLE_FLAG_TEXT_MODE = $00000400; Console supports text mode settings
CONSOLE_FLAG_TEXT_BLINK = $00000800; Console supports blinking text
CONSOLE_FLAG_COLOR = $00001000; Console supports colors
CONSOLE_FLAG_FONT = $00002000; Console supports font
CONSOLE_FLAG_FULLSCREEN = $00004000; Console supports creating a fullscreen window
CONSOLE_FLAG_AUTO_SCROLL = $00008000; Automatically scroll up on reaching the last line
CONSOLE_FLAG_DMA_TEXT = $00010000; Use DMA to draw text (Where applicable)
CONSOLE_FLAG_COLOR_REVERSE = $00020000; Console requires colors to be reversed for underlying hardware
CONSOLE_FLAG_TEXT_CARET = $00040000; Console supports a caret (Text cursor)
CONSOLE_FLAG_FOCUS_CARET = $00080000; Only show caret on the focused (active) window
 
CONSOLE_FLAG_DMA_MASK = CONSOLE_FLAG_DMA_BOX or CONSOLE_FLAG_DMA_LINE or CONSOLE_FLAG_DMA_FILL or CONSOLE_FLAG_DMA_CLEAR or CONSOLE_FLAG_DMA_SCROLL or CONSOLE_FLAG_DMA_TEXT;
Flags that cannot be changed by ConsoleDeviceUpdateFlag
CONSOLE_FLAG_INTERNAL = CONSOLE_FLAG_SINGLE_WINDOW or CONSOLE_FLAG_HARDWARE_CURSOR or CONSOLE_FLAG_HARDWARE_CARET or CONSOLE_FLAG_BLINK_CARET or CONSOLE_FLAG_TEXT_MODE or CONSOLE_FLAG_TEXT_BLINK or CONSOLE_FLAG_COLOR or CONSOLE_FLAG_FONT or CONSOLE_FLAG_FULLSCREEN or CONSOLE_FLAG_COLOR_REVERSE or CONSOLE_FLAG_TEXT_CARET;


Console device mode CONSOLE_MODE_*
CONSOLE_MODE_NONE = 0;  
CONSOLE_MODE_PIXEL = 1;  
CONSOLE_MODE_CHARACTER = 2;  


Console caret signature CARET_SIGNATURE*
CARET_SIGNATURE = $9A2D40E3;  


Console window signature WINDOW_SIGNATURE_*
WINDOW_SIGNATURE = $DE3A5C04;  


Console window state WINDOW_STATE_*
WINDOW_STATE_INVISIBLE = 0;  
WINDOW_STATE_VISIBLE = 1;  
 
WINDOW_STATE_MAX = 1;  


Console window mode WINDOW_MODE_*
WINDOW_MODE_NONE = 0;  
WINDOW_MODE_TEXT = 1;  
WINDOW_MODE_GRAPHICS = 2;  
 
WINDOW_MODE_MAX = 2;  


Console window flag WINDOW_FLAG_*
WINDOW_FLAG_NONE = $00000000;  
WINDOW_FLAG_LINE_WRAP = $00000001; Wrap long lines to the next line if set
WINDOW_FLAG_BUFFERED = $00000002; Buffer output for scroll back and redraw
WINDOW_FLAG_FULLSCREEN = $00000004; Window occupies the full screen
WINDOW_FLAG_AUTO_SCROLL = $00000008; Automatically scroll up on reaching the last line
WINDOW_FLAG_CHARACTER = $00000010; Console for this Window is character mode only
WINDOW_FLAG_AUTO_UPDATE = $00000020; Automatically update output of buffered window
WINDOW_FLAG_FOCUS_CURSOR = $00000040; Only show cursor (caret) on the focused (active) window
 
Flags that cannot be changed by ConsoleWindowUpdateFlag
WINDOW_FLAG_INTERNAL = WINDOW_FLAG_FULLSCREEN or WINDOW_FLAG_CHARACTER;


Console window draw flag WINDOW_DRAW_FLAG_*
WINDOW_DRAW_FLAG_NONE = $00000000;  
WINDOW_DRAW_FLAG_BODY = $00000001; Draw the Window body
WINDOW_DRAW_FLAG_TITLE = $00000002; Draw the Window title
WINDOW_DRAW_FLAG_BORDER = $00000004; Draw the Window border
 
WINDOW_DRAW_FLAG_ALL = WINDOW_DRAW_FLAG_BODY or WINDOW_DRAW_FLAG_TITLE or WINDOW_DRAW_FLAG_BORDER;


Console window history WINDOW_HISTORY_*
WINDOW_HISTORY_MAX_COUNT = 100;  


Framebuffer console FRAMEBUFFER_CONSOLE_*
FRAMEBUFFER_CONSOLE_TITLE = 'Ultibo Core (Release: ' + ULTIBO_RELEASE_NAME + ' Version: ' + ULTIBO_RELEASE_VERSION + ' Date: ' + ULTIBO_RELEASE_DATE + ')';  
FRAMEBUFFER_CONSOLE_DESCRIPTION = 'Framebuffer Console'; Description of the Framebuffer Console device


Type definitions



Cursor mode

TCursorMode = (CURSOR_MODE_INSERT,CURSOR_MODE_OVERWRITE);

Cursor state

TCursorState = (CURSORON,CURSOROFF);

Cursor shape

TCursorShape = (CURSOR_SHAPE_LINE,CURSOR_SHAPE_BAR,CURSOR_SHAPE_BLOCK); Line is a vertical line, Bar is a horizontal bar and Block is a solid block (All shapes inverse any character data under them)

Console char

PConsoleChar = ^TConsoleChar;

TConsoleChar = record

Ch:Char;  
Forecolor:LongWord;  
Backcolor:LongWord;  

Console point

TConsolePoint = record

X:LongWord;  
Y:LongWord;  

Console rect

TConsoleRect = record

X1:LongWord;  
Y1:LongWord;  
X2:LongWord;  
Y2:LongWord;  

Console properties

PConsoleProperties = ^TConsoleProperties;

TConsoleProperties = record

Flags:LongWord; Console device flags (eg CONSOLE_FLAG_FULLSCREEN)
Mode:LongWord; Console device mode (eg CONSOLE_MODE_PIXEL)
Width:LongWord; Console Width (Pixels for CONSOLE_MODE_PIXEL/Characters for CONSOLE_MODE_CHARACTER)
Height:LongWord; Console Height (Pixels for CONSOLE_MODE_PIXEL/Characters for CONSOLE_MODE_CHARACTER)
Format:LongWord; Color Format (eg COLOR_FORMAT_ARGB32)(Only applicable if CONSOLE_MODE_PIXEL)

Console enumeration callback

TConsoleEnumerate = function(Console:PConsoleDevice; Data:Pointer):LongWord;

Console notification callback

TConsoleNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;

Console device open

TConsoleDeviceOpen = function(Console:PConsoleDevice):LongWord;

Console device close

TConsoleDeviceClose = function(Console:PConsoleDevice):LongWord;

Console device clear

TConsoleDeviceClear = function(Console:PConsoleDevice; Color:LongWord):LongWord;

Console device scroll

TConsoleDeviceScroll = function(Console:PConsoleDevice; X1,Y1,X2,Y2,Count,Direction:LongWord):LongWord;

Console device draw box

TConsoleDeviceDrawBox = function(Console:PConsoleDevice; X1,Y1,X2,Y2,Color,Width:LongWord):LongWord;

Console device draw line

TConsoleDeviceDrawLine = function(Console:PConsoleDevice; X1,Y1,X2,Y2,Color,Width:LongWord):LongWord;

Console device plot line

TConsoleDevicePlotLine = function(Console:PConsoleDevice; X1,Y1,X2,Y2,Color,Width:LongWord):LongWord;

Console device draw char

TConsoleDeviceDrawChar = function(Console:PConsoleDevice; Handle:TFontHandle; Ch:Char;X,Y,Forecolor,Backcolor:LongWord):LongWord;

Console device draw text

TConsoleDeviceDrawText = function(Console:PConsoleDevice; Handle:TFontHandle; const Text:String;X,Y,Forecolor,Backcolor,Len:LongWord):LongWord;

Console device draw pixel

TConsoleDeviceDrawPixel = function(Console:PConsoleDevice; X,Y,Color:LongWord):LongWord;

Console device draw block

TConsoleDeviceDrawBlock = function(Console:PConsoleDevice; X1,Y1,X2,Y2,Color:LongWord):LongWord;

Console device draw circle

TConsoleDeviceDrawCircle = function(Console:PConsoleDevice; X,Y,Color,Width,Radius:LongWord):LongWord;

Console device draw image

TConsoleDeviceDrawImage = function(Console:PConsoleDevice; X,Y:LongWord; Buffer:Pointer; Width,Height,Format,Skip:LongWord):LongWord;

Console device draw window

TConsoleDeviceDrawWindow = function(Console:PConsoleDevice; Handle:TWindowHandle):LongWord;

Console device get pixel

TConsoleDeviceGetPixel = function(Console:PConsoleDevice; X,Y:LongWord; var Color:LongWord):LongWord;

Console device get image

TConsoleDeviceGetImage = function(Console:PConsoleDevice; X,Y:LongWord; Buffer:Pointer; Width,Height,Format,Skip:LongWord):LongWord;

Console device put text

TConsoleDevicePutText = function(Console:PConsoleDevice; Handle:TFontHandle; const Source,Dest:TConsolePoint; Buffer:PConsoleChar; Width,Height,Skip:LongWord):LongWord;

Console device copy image

TConsoleDeviceCopyImage = function(Console:PConsoleDevice; const Source,Dest:TConsolePoint; Width,Height:LongWord):LongWord;

Console device add caret

TConsoleDeviceAddCaret = function(Console:PConsoleDevice; Width,Height,OffsetX,OffsetY:LongWord):THandle;

Console device delete caret

TConsoleDeviceDeleteCaret = function(Console:PConsoleDevice; Handle:THandle):LongWord;

Console device update caret

TConsoleDeviceUpdateCaret = function(Console:PConsoleDevice; Handle:THandle; X,Y:LongWord; Visible,Blink:Boolean):LongWord;

Console device update caret extended

TConsoleDeviceUpdateCaretEx = function(Console:PConsoleDevice; Handle:THandle; X,Y,Forecolor,Backcolor:LongWord; Visible,Blink,Reverse:Boolean):LongWord;

Console device set cursor

TConsoleDeviceSetCursor = function(Console:PConsoleDevice; Width,Height:LongWord; Chars:PChar):LongWord;

Console device update cursor

TConsoleDeviceUpdateCursor = function(Console:PConsoleDevice; Enabled:Boolean; X,Y:LongInt; Relative:Boolean):LongWord;

Console device get position

TConsoleDeviceGetPosition = function(Console:PConsoleDevice; Position:LongWord; var X1,Y1,X2,Y2:LongWord):LongWord;

Console device get properties

TConsoleDeviceGetProperties = function(Console:PConsoleDevice; Properties:PConsoleProperties):LongWord;

Console device

PConsoleDevice = ^TConsoleDevice;

TConsoleDevice = record

Device Properties
Device:TDevice; The Device entry for this Console device
Console Properties
ConsoleId:LongWord; Unique Id of this Console device in the Console device table
ConsoleState:LongWord; Console device state (eg CONSOLE_STATE_OPEN)
ConsoleMode:LongWord; Console device mode (eg CONSOLE_MODE_PIXEL)
DeviceOpen:TConsoleDeviceOpen; A device specific DeviceOpen method implementing a standard console device interface (Mandatory)
DeviceClose:TConsoleDeviceClose; A device specific DeviceClose method implementing a standard console device interface (Mandatory)
DeviceClear:TConsoleDeviceClear; A device specific DeviceClear method implementing a standard console device interface (Mandatory)
DeviceScroll:TConsoleDeviceScroll; A device specific DeviceScroll method implementing a standard console device interface (Mandatory)
DeviceDrawBox:TConsoleDeviceDrawBox; A device specific DeviceDrawBox method implementing a standard console device interface (Mandatory for CONSOLE_MODE_PIXEL)
DeviceDrawLine:TConsoleDeviceDrawLine; A device specific DeviceDrawLine method implementing a standard console device interface (Mandatory for CONSOLE_MODE_PIXEL)
DevicePlotLine:TConsoleDevicePlotLine; A device specific DevicePlotLine method implementing a standard console device interface (Or nil if the default method is suitable)
DeviceDrawChar:TConsoleDeviceDrawChar; A device specific DeviceDrawChar method implementing a standard console device interface (Mandatory)
DeviceDrawText:TConsoleDeviceDrawText; A device specific DeviceDrawText method implementing a standard console device interface (Mandatory)
DeviceDrawPixel:TConsoleDeviceDrawPixel; A device specific DeviceDrawPixel method implementing a standard console device interface (Mandatory for CONSOLE_MODE_PIXEL)
DeviceDrawBlock:TConsoleDeviceDrawBlock; A device specific DeviceDrawBlock method implementing a standard console device interface (Mandatory)
DeviceDrawCircle:TConsoleDeviceDrawCircle; A device specific DeviceDrawCircle method implementing a standard console device interface (Or nil if the default method is suitable)
DeviceDrawImage:TConsoleDeviceDrawImage; A device specific DeviceDrawImage method implementing a standard console device interface (Mandatory for CONSOLE_MODE_PIXEL)
DeviceDrawWindow:TConsoleDeviceDrawWindow; A device specific DeviceDrawWindow method implementing a standard console device interface (Mandatory)
DeviceGetPixel:TConsoleDeviceGetPixel; A device specific DeviceGetPixel method implementing a standard console device interface (Mandatory for CONSOLE_MODE_PIXEL)
DeviceGetImage:TConsoleDeviceGetImage; A device specific DeviceGetImage method implementing a standard console device interface (Mandatory for CONSOLE_MODE_PIXEL)
DevicePutText:TConsoleDevicePutText; A device specific DevicePutText method implementing a standard console device interface (Mandatory)
DeviceCopyImage:TConsoleDeviceCopyImage; A device specific DeviceCopyImage method implementing a standard console device interface (Mandatory for CONSOLE_MODE_PIXEL)
DeviceAddCaret:TConsoleDeviceAddCaret; A device specific DeviceAddCaret method implementing a standard console device interface (Optional)
DeviceDeleteCaret:TConsoleDeviceDeleteCaret; A device specific DeviceDeleteCaret method implementing a standard console device interface (Optional)
DeviceUpdateCaret:TConsoleDeviceUpdateCaret; A device specific DeviceUpdateCaret method implementing a standard console device interface (Optional)
DeviceUpdateCaretEx:TConsoleDeviceUpdateCaretEx; A device specific DeviceUpdateCaretEx method implementing a standard console device interface (Optional)
DeviceSetCursor:TConsoleDeviceSetCursor; A device specific DeviceSetCursor method implementing a standard console device interface (Or nil if the default method is suitable)(CONSOLE_MODE_CHARACTER only)
DeviceUpdateCursor:TConsoleDeviceUpdateCursor; A device specific DeviceUpdateCursor method implementing a standard console device interface (Or nil if the default method is suitable)(CONSOLE_MODE_CHARACTER only)
DeviceGetPosition:TConsoleDeviceGetPosition; A device specific DeviceGetPosition method implementing a standard console device interface (Mandatory)
DeviceGetProperties:TConsoleDeviceGetProperties; A device specific DeviceGetProperties method implementing a standard console device interface (Or nil if the default method is suitable)
Statistics Properties
OpenCount:LongWord;  
CloseCount:LongWord;  
ClearCount:LongWord;  
ScrollCount:LongWord;  
DrawCount:LongWord;  
GetCount:LongWord;  
PutCount:LongWord;  
CopyCount:LongWord;  
Driver Properties
Lock:TMutexHandle; Device lock
Width:LongWord; Console Width (Pixels for CONSOLE_MODE_PIXEL/Characters for CONSOLE_MODE_CHARACTER)
Height:LongWord; Console Height (Pixels for CONSOLE_MODE_PIXEL/Characters for CONSOLE_MODE_CHARACTER)
Format:LongWord; Color Format (eg COLOR_FORMAT_ARGB32)(Only applicable if CONSOLE_MODE_PIXEL)
Forecolor:LongWord; Foreground Color
Backcolor:LongWord; Background Color
Borderwidth:LongWord; Border Width (Pixels for CONSOLE_MODE_PIXEL/Characters for CONSOLE_MODE_CHARACTER)
Bordercolor:LongWord; Border Color
Font Properties
Font:TFontHandle; Console Font
FontRatio:LongWord; Font Characters to Pixels Ratio (Normally 1 for Pixel Console/0 for Character Console)
Cursor Properties
CursorUpdate:LongBool; Flag to indicate if cursor update (Show/Hide) is in progress (CONSOLE_MODE_CHARACTER only)
CursorX:LongWord; Cursor X (Characters)(CONSOLE_MODE_CHARACTER only)
CursorY:LongWord; Cursor Y (Characters)(CONSOLE_MODE_CHARACTER only)
CursorWidth:LongWord; Cursor Width (Characters)(CONSOLE_MODE_CHARACTER only)
CursorHeight:LongWord; Cursor Height (Characters)(CONSOLE_MODE_CHARACTER only)
CursorVisible:LongBool; Cursor Visible On/Off (CONSOLE_MODE_CHARACTER only)
CursorChars:PChar; Buffer for cursor characters (CONSOLE_MODE_CHARACTER only)
CursorBuffer:PChar; Buffer for characters currently under cursor (CONSOLE_MODE_CHARACTER only)
Caret Properties
CaretFirst:PConsoleCaret;  
CaretLock:TCriticalSectionHandle;  
CaretCount:LongWord;  
Window Properties
WindowFirst:PConsoleWindow;  
WindowLock:TCriticalSectionHandle;  
WindowCount:LongWord;  
WindowDefault:TWindowHandle;  
Internal Properties
Prev:PConsoleDevice; Previous entry in Console device table
Next:PConsoleDevice; Next entry in Console device table

Console caret

TConsoleCaret = record

Caret Properties
Signature:LongWord; Signature for entry validation
X:LongWord; Caret X (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Y:LongWord; Caret Y (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Width:LongWord; Caret Width (Pixels for CONSOLE_MODE_PIXEL / Always 1 for CONSOLE_MODE_CHARACTER)
Height:LongWord; Caret Height (Pixels for CONSOLE_MODE_PIXEL / Always 1 for CONSOLE_MODE_CHARACTER)
OffsetX:LongWord; Caret Offset X (Pixels for CONSOLE_MODE_PIXEL / Always 0 for CONSOLE_MODE_CHARACTER)
OffsetY:LongWord; Caret Offset Y (Pixels for CONSOLE_MODE_PIXEL / Always 0 for CONSOLE_MODE_CHARACTER)
Visible:LongBool; Caret Visible On/Off
Blink:LongBool; Caret Blink On/Off
Reverse:LongBool; Caret Color Reverse or Inverse
Forecolor:LongWord; Caret Foreground Color
Backcolor:LongWord; Caret Background Color
Console:PConsoleDevice; Console device
Driver Properties
Handle:THandle; Device specific handle
Active:LongBool; Caret currently active (displayed) (Independent of Visible to account for Blink)
Image:Pointer; Device specific buffer for caret image
Buffer:Pointer; Device specific buffer for area underneath caret
Output:Pointer; Device specific buffer for curently displayed caret
Internal Properties
Prev:PConsoleCaret; Previous entry in Console Caret table
Next:PConsoleCaret; Next entry in Console Caret table

Window properties

PWindowProperties = ^TWindowProperties;

TWindowProperties = record

Position:LongWord; Console Window Position (eg CONSOLE_POSITION_TOP)
State:LongWord; Console Window State (eg WINDOW_STATE_VISIBLE)
Mode:LongWord; Console Window Mode (eg WINDOW_MODE_TEXT)
Flags:LongWord; Console Window Flags (eg WINDOW_FLAG_LINE_WRAP)
X1:LongWord; (Window X1) Console Relative (Pixels for CONSOLE_MODE_PIXEL/Characters for CONSOLE_MODE_CHARACTER)
Y1:LongWord; (Window Y1) Console Relative (Pixels for CONSOLE_MODE_PIXEL/Characters for CONSOLE_MODE_CHARACTER)
X2:LongWord; (Window X2)Console Relative (Pixels for CONSOLE_MODE_PIXEL/Characters for CONSOLE_MODE_CHARACTER)
Y2:LongWord; (Window Y2) Console Relative (Pixels for CONSOLE_MODE_PIXEL/Characters for CONSOLE_MODE_CHARACTER)
Width:LongWord; Window Width in Columns (Characters for WINDOW_MODE_TEXT/Pixels for WINDOW_MODE_GRAPHICS)
Height:LongWord; Window Height in Rows (Characters for WINDOW_MODE_TEXT/Pixels for WINDOW_MODE_GRAPHICS)
OffsetX:LongWord; Window X Offset (Pixels for CONSOLE_MODE_PIXEL/Characters for CONSOLE_MODE_CHARACTER)
OffsetY:LongWord; Window Y Offset (Pixels for CONSOLE_MODE_PIXEL/Characters for CONSOLE_MODE_CHARACTER)
FontWidth:LongWord; Font Width (Pixels)
FontHeight:LongWord; Font Height (Pixels)
Borderwidth:LongWord; Current Border Width
Font:TFontHandle; Window Font
Console:PConsoleDevice; Window console

Console window enumeration callback

TConsoleWindowEnumerate = function(Console:PConsoleDevice; Handle:TWindowHandle; Data:Pointer):LongWord;

Console window completion callback

TConsoleWindowCompletion = function(Handle:TWindowHandle; var Buffer:String; Data:Pointer):LongWord;

Console window

PConsoleWindow = ^TConsoleWindow;

TConsoleWindow = record

Window Properties
Signature:LongWord; Signature for entry validation
Position:LongWord; Console Window Position (eg CONSOLE_POSITION_TOP)
WindowState:LongWord; Console Window State (eg WINDOW_STATE_VISIBLE)
WindowMode:LongWord; Console Window Mode (eg WINDOW_MODE_TEXT)
WindowFlags:LongWord; Console Window Flags (eg WINDOW_FLAG_LINE_WRAP)
X1:LongWord; (Window X1) Console Relative (Pixels for CONSOLE_MODE_PIXEL/Characters for CONSOLE_MODE_CHARACTER)
Y1:LongWord; (Window Y1) Console Relative (Pixels for CONSOLE_MODE_PIXEL/Characters for CONSOLE_MODE_CHARACTER)
X2:LongWord; (Window X2) Console Relative (Pixels for CONSOLE_MODE_PIXEL/Characters for CONSOLE_MODE_CHARACTER)
Y2:LongWord; Window Y2) Console Relative (Pixels for CONSOLE_MODE_PIXEL/Characters for CONSOLE_MODE_CHARACTER)
Width:LongWord; Window Width in Columns (Characters for WINDOW_MODE_TEXT/Pixels for WINDOW_MODE_GRAPHICS)
Height:LongWord; Window Height in Rows (Characters for WINDOW_MODE_TEXT/Pixels for WINDOW_MODE_GRAPHICS)
OffsetX:LongWord; Window X Offset (Pixels for CONSOLE_MODE_PIXEL/Characters for CONSOLE_MODE_CHARACTER)
OffsetY:LongWord; Window Y Offset (Pixels for CONSOLE_MODE_PIXEL/Characters for CONSOLE_MODE_CHARACTER)
MinX:LongWord; (Viewport X1) Window Relative (Characters for WINDOW_MODE_TEXT/Pixels for WINDOW_MODE_GRAPHICS)
MinY:LongWord; (Viewport Y1) Window Relative (Characters for WINDOW_MODE_TEXT/Pixels for WINDOW_MODE_GRAPHICS)
MaxX:LongWord; (Viewport X2) Window Relative (Characters for WINDOW_MODE_TEXT/Pixels for WINDOW_MODE_GRAPHICS)
MaxY:LongWord; (Viewport Y2) Window Relative (Characters for WINDOW_MODE_TEXT/Pixels for WINDOW_MODE_GRAPHICS)
X:LongWord; (Current X) Window Relative (Characters for WINDOW_MODE_TEXT/Not used for WINDOW_MODE_GRAPHICS)
Y:LongWord; (Current Y) Window Relative (Characters for WINDOW_MODE_TEXT/Not used for WINDOW_MODE_GRAPHICS)
Cols:LongWord; Viewport Columns (Characters for WINDOW_MODE_TEXT/Pixels for WINDOW_MODE_GRAPHICS)
Rows:LongWord; Viewport Rows (Characters for WINDOW_MODE_TEXT/Pixels for WINDOW_MODE_GRAPHICS)
Format:LongWord; Color Format (eg COLOR_FORMAT_ARGB32)(Only applicable if CONSOLE_MODE_PIXEL)
Forecolor:LongWord; Current Foreground Color
Backcolor:LongWord; Current Background Color
Borderwidth:LongWord; Current Border Width
Bordercolor:LongWord; Current Border Color
Font Properties
Font:TFontHandle; Window Font
FontWidth:LongWord; Font Width (Pixels)
FontHeight:LongWord; Font Height (Pixels)
Cursor Properties
CursorX:LongWord; (Cursor X) Window Relative (Characters for WINDOW_MODE_TEXT/Not used for WINDOW_MODE_GRAPHICS)
CursorY:LongWord; (Cursor Y) Window Relative (Characters for WINDOW_MODE_TEXT/Not used for WINDOW_MODE_GRAPHICS)
CursorMode:LongWord; Cursor Mode (eg CURSOR_MODE_INSERT)
CursorBlink:Boolean; Cursor Blink On/Off
CursorState:TCursorState; Cursor State On/Off
CursorShape:TCursorShape; Cursor Shape Line/Bar/Block
CursorReverse:LongBool; Cursor Color Reverse or Inverse (WINDOW_MODE_TEXT only)
CursorForecolor:LongWord; Cursor Foreground Color (WINDOW_MODE_TEXT only)
CursorBackcolor:LongWord; Cursor Background Color (WINDOW_MODE_TEXT only)
Caret Properties
CaretX:LongWord; Caret X Console Relative (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
CaretY:LongWord; Caret Y Console Relative (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
CaretHandle:THandle; Caret (Cursor) Handle (or INVALID_HANDLE_VALUE)
History Properties
HistoryFirst:PConsoleHistory;  
HistoryLast:PConsoleHistory;  
HistoryCurrent:PConsoleHistory;  
HistoryCount:LongWord;  
Driver Properties
Lock:TMutexHandle; Window lock
Console:PConsoleDevice; Window console
Internal Properties
Prev:PConsoleWindow; Previous entry in Console Window table
Next:PConsoleWindow; Next entry in Console Window table

Console history

TConsoleHistory = record

History Properties
Value:PChar;  
Length:Integer;  
Internal Properties
Prev:PConsoleHistory; Previous entry in History table
Next:PConsoleHistory; Next entry in History table

Framebuffer console

PFramebufferConsole = ^TFramebufferConsole;

TFramebufferConsole = record

Console Properties
Console:TConsoleDevice;  
Framebuffer Properties
Framebuffer:PFramebufferDevice;  
DesktopX:LongWord; Desktop X (Left) Console Relative (Pixels)
DesktopY:LongWord; Desktop Y (Right) Console Relative (Pixels)
DesktopWidth:LongWord; Desktop (Width) Console Relative (Pixels)
DesktopHeight:LongWord; Desktop (Height) Console Relative (Pixels)
DesktopOffset:LongWord; Desktop (Offset)
DesktopColor:LongWord; Desktop (Color)
Buffer Properties
LineBuffer:Pointer; Buffer for device reads and writes (Size of one line)


Public variables


None defined

Function declarations



Initialization functions

procedure ConsoleInit;
Description: Initialize the Console unit and Console device table
Note Called only during system startup


Console functions

function ConsoleDeviceOpen(Console:PConsoleDevice):LongWord;
Description: Open a console device ready for drawing
Console The console device to open
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleDeviceClose(Console:PConsoleDevice):LongWord;
Description: Close a console device to prevent drawing
Console The console device to close
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleDeviceClear(Console:PConsoleDevice; Color:LongWord):LongWord;
Description: Clear a console device using the specified color
Console The console device to clear
Color The color to use when clearing the console
Return ERROR_SUCCESS if completed or another error code on failure
Note Color must be specified in the default color format (See COLOR_FORMAT_DEFAULT)


function ConsoleDeviceScroll(Console:PConsoleDevice; X1,Y1,X2,Y2,Count,Direction:LongWord):LongWord;
Description: Scroll all or part of a console device in the specified direction
Console The console device to scroll
X1 The left edge of the area to scroll (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Y1 The top edge of the area to scroll (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
X2 The right edge of the area to scroll (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Y2 The bottom edge of the area to scroll (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Count The number of pixels or characters (depending on console mode) to scroll
Direction The direction to scroll (eg CONSOLE_DIRECTION_UP)
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleDeviceDrawBox(Console:PConsoleDevice; X1,Y1,X2,Y2,Color,Width:LongWord):LongWord;
Description: Draw an outline of a box on a console device
Console The console device to draw on
X1 The left edge of the box (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Y1 The top edge of the box (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
X2 The right edge of the box (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Y2 The bottom edge of the box (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Color The color to draw with (eg COLOR_WHITE)
Width The width of the box outline (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Return ERROR_SUCCESS if completed or another error code on failure
Note Color must be specified in the default color format (See COLOR_FORMAT_DEFAULT)


function ConsoleDeviceDrawLine(Console:PConsoleDevice; X1,Y1,X2,Y2,Color,Width:LongWord):LongWord;
Description: Draw a horizontal or vertical line on a console device
Console The console device to draw on
X1 The left starting point of the line (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Y1 The top starting point of the line (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
X2 The right ending point of the line (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Y2 The bottom ending point of the line (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Color The color to draw with (eg COLOR_WHITE)
Width The width of the line (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Return ERROR_SUCCESS if completed or another error code on failure
Note Color must be specified in the default color format (See COLOR_FORMAT_DEFAULT)


function ConsoleDevicePlotLine(Console:PConsoleDevice; X1,Y1,X2,Y2,Color,Width:LongWord):LongWord;
Description: Draw a line in any direction on a console device
Console The console device to draw on
X1 The left starting point of the line (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Y1 The top starting point of the line (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
X2 The right ending point of the line (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Y2 The bottom ending point of the line (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Color The color to draw with (eg COLOR_WHITE)
Width The width of the line (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Return ERROR_SUCCESS if completed or another error code on failure
Note Color must be specified in the default color format (See COLOR_FORMAT_DEFAULT)

Character consoles may implement plot line but the default method only supports pixel consoles


function ConsoleDeviceDrawChar(Console:PConsoleDevice; Handle:TFontHandle; Ch:Char; X,Y,Forecolor,Backcolor:LongWord):LongWord;
Description: Draw a character on a console device
Console The console device to draw on
Handle The handle of the font to draw with
Ch The character to draw
X The left starting point of the character (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Y The top starting point of the character (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Forecolor The foreground color for the character (eg COLOR_WHITE)
Backcolor The background color for the character (eg COLOR_BLACK)
Return ERROR_SUCCESS if completed or another error code on failure
Note Forecolor and Backcolor must be specified in the default color format (See COLOR_FORMAT_DEFAULT)


function ConsoleDeviceDrawText(Console:PConsoleDevice; Handle:TFontHandle; const Text:String; X,Y,Forecolor,Backcolor,Len:LongWord):LongWord;
Description: Draw a text string on a console device
Console The console device to draw on
Handle The handle of the font to draw with
Text The text to draw
X The left starting point of the text (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Y The top starting point of the text (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Forecolor The foreground color for the text (eg COLOR_WHITE)
Backcolor The background color for the text (eg COLOR_BLACK)
Len The length of the text (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Return ERROR_SUCCESS if completed or another error code on failure
Note Forecolor and Backcolor must be specified in the default color format (See COLOR_FORMAT_DEFAULT)


function ConsoleDeviceDrawPixel(Console:PConsoleDevice; X,Y,Color:LongWord):LongWord;
Description: Draw a pixel on a console device
Console The console device to draw on
X The column to draw the pixel (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Y The row to draw the pixel (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Color The color to draw with (eg COLOR_WHITE)
Return ERROR_SUCCESS if completed or another error code on failure
Note Color must be specified in the default color format (See COLOR_FORMAT_DEFAULT)


function ConsoleDeviceDrawBlock(Console:PConsoleDevice; X1,Y1,X2,Y2,Color:LongWord):LongWord;
Description: Draw a filled block on a console device
Console The console device to draw on
X1 The left edge of the block (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Y1 The top edge of the block (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
X2 The right edge of the block (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Y2 The bottom edge of the block (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Color The color to draw with (eg COLOR_WHITE)
Return ERROR_SUCCESS if completed or another error code on failure
Note Color must be specified in the default color format (See COLOR_FORMAT_DEFAULT)


function ConsoleDeviceDrawCircle(Console:PConsoleDevice; X,Y,Color,Width,Radius:LongWord):LongWord;
Description: Draw a circle on a console device
Console The console device to draw on
X The column center point of the circle (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Y The row center point of the circle (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Color The color to draw with (eg COLOR_WHITE)
Width The width of the circle outline (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Radius The radius of the circle (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Return ERROR_SUCCESS if completed or another error code on failure
Note Color must be specified in the default color format (See COLOR_FORMAT_DEFAULT)

Character consoles may implement draw circle but the default method only supports pixel consoles


function ConsoleDeviceDrawImage(Console:PConsoleDevice; X,Y:LongWord; Buffer:Pointer; Width,Height,Format,Skip:LongWord):LongWord;
Description: Draw an image on a console device
Console The console device to draw on
X The starting column of the image (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Y The starting row of the image (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Buffer Pointer to a block of memory containing the pixels of the image in a contiguous block of rows
Width The number of columns in the image (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Height The number of rows in the image (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Format The color format of the image (eg COLOR_FORMAT_RGB24)
Skip The number of pixels to skip in the buffer after each row (Optional)
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleDeviceDrawWindow(Console:PConsoleDevice; Handle:TWindowHandle; Flags:LongWord):LongWord;
Description: Draw a console window on a console device
Console The console device to draw on
Handle The handle of the console window to draw
Flags Flags to specify what should be drawn (eg WINDOW_DRAW_FLAG_BORDER)
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleDeviceGetPixel(Console:PConsoleDevice; X,Y:LongWord; var Color:LongWord):LongWord;
Description: Read a pixel from a console device
Console The console device to read from
X The column to read the pixel from (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Y The row to read the pixel from (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Color The color value read from the console (eg COLOR_WHITE)
Return ERROR_SUCCESS if completed or another error code on failure
Note Color is returned in the default color format (See COLOR_FORMAT_DEFAULT)


function ConsoleDeviceGetImage(Console:PConsoleDevice; X,Y:LongWord; Buffer:Pointer; Width,Height,Format,Skip:LongWord):LongWord;
Description: Read an image from a console device
Console The console device to read from
X The starting column to read the image from (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Y The starting row to read the image from (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Buffer Pointer to a block of memory large enough to hold the pixels of the image in a contiguous block of rows
Width The number of columns to store in the image (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Height The number of rows to store in the image (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Format The color format to store the image in (eg COLOR_FORMAT_RGB24)
Skip The number of pixels to skip in the buffer after each row (Optional)
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleDevicePutText(Console:PConsoleDevice; Handle:TFontHandle; const Source,Dest:TConsolePoint; Buffer:PConsoleChar; Width,Height,Skip:LongWord):LongWord;
Description: Output a rectangular area of text to a console device
Console The console device to output to
Source The X and Y point in the source buffer to copy text from (Characters)
Dest The X and Y point on the console device to copy text to (Pixels for CONSOLE_MODE_PIXEL/Characters for CONSOLE_MODE_CHARACTER)
Buffer A pointer to a buffer of TConsoleChar structures which represent rows of text
Width The width of the area to be output (Characters)
Height The height of the area to be output (Characters)
Skip The number of characters to skip in the buffer after each row (Optional)
Return ERROR_SUCCESS if completed or another error code on failure
Note Source, Width, Heigth and Skip are based on character rows and columns not screen pixels.


function ConsoleDeviceCopyImage(Console:PConsoleDevice; const Source,Dest:TConsolePoint; Width,Height:LongWord):LongWord;
Description: Copy an image within a console device
Console The console device to copy on
Source The starting point for the source of the copy (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Dest The starting point for the destination of the copy (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Width The number of columns in the image (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Height The number of rows in the image (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleDeviceAddCaret(Console:PConsoleDevice; Width,Height,OffsetX,OffsetY:LongWord):THandle;
Description: Create a new caret (cursor) of the specified size
Console The console device to create the caret on
Width The width of the new caret (Pixels for CONSOLE_MODE_PIXEL / Always 1 for CONSOLE_MODE_CHARACTER)
Height The height of the new caret (Pixels for CONSOLE_MODE_PIXEL / Always 1 for CONSOLE_MODE_CHARACTER)
OffsetX The X offset of the new caret (Optional)(Pixels for CONSOLE_MODE_PIXEL / Always 0 for CONSOLE_MODE_CHARACTER)
OffsetY The Y offset of the new caret (Optional)(Pixels for CONSOLE_MODE_PIXEL / Always 0 for CONSOLE_MODE_CHARACTER)
Return Handle to new caret on success or INVALID_HANDLE_VALUE on failure


function ConsoleDeviceDeleteCaret(Console:PConsoleDevice; Handle:THandle):LongWord;
Description: Delete an existing caret (cursor)
Console The console device to delete the caret on
Handle The handle of the caret to delete (as returned from ConsoleDeviceAddCaret)
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleDeviceUpdateCaret(Console:PConsoleDevice; Handle:THandle; X,Y:LongWord; Visible,Blink:Boolean):LongWord; inline;
Description: Update an existing carets position, visibility or blink
Console The console device to update the caret on
Handle The handle of the caret to update (as returned from ConsoleDeviceAddCaret)
X The X position of the caret (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Y The Y position of the caret (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Visible If true then show the caret else hide it
Blink If true then blink the caret at the default blink rate
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleDeviceUpdateCaretEx(Console:PConsoleDevice; Handle:THandle; X,Y,Forecolor,Backcolor:LongWord; Visible,Blink,Reverse:Boolean):LongWord;
Description: Update an existing carets position, colors, visibility, blink or reverse
Console The console device to update the caret on
Handle The handle of the caret to update (as returned from ConsoleDeviceAddCaret)
X The X position of the caret (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Y The Y position of the caret (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Forecolor The cursor foreground color if set or COLOR_NONE to disable
Backcolor The cursor background color if set or COLOR_NONE to disable
Visible If true then show the caret else hide it
Blink If true then blink the caret at the default blink rate
Reverse If true then enable reverse color else enable inverse color
Return ERROR_SUCCESS if completed or another error code on failure
Note Forecolor and Backcolor must be specified in the default color format (See COLOR_FORMAT_DEFAULT)


function ConsoleDeviceSetCursor(Console:PConsoleDevice; Width,Height:LongWord; Chars:PChar):LongWord;
Description: Set the mouse cursor properties of a console device (CONSOLE_MODE_CHARACTER only)
Console The console device to set the cursor
Width The width of the cursor in characters
Height The height of the cursor in characters
Chars A buffer containing the cursor characters
Return ERROR_SUCCESS if completed or another error code on failure
Note For devices that don't support hardware mouse cursor a software cursor will be implemented

If chars is nil then the default cursor will be used


function ConsoleDeviceUpdateCursor(Console:PConsoleDevice; Enabled:Boolean; X,Y:LongInt; Relative:Boolean):LongWord;
Description: Update the position and state for the mouse cursor of a console device (CONSOLE_MODE_CHARACTER only)
Console The console device to update the cursor
Enabled If true then show the cursor else hide it
X The cursor X location in characters
Y The cursor Y location in characters
Relative If true then X and Y are considered relative to the current position
Return ERROR_SUCCESS if completed or another error code on failure
Note For devices that don't support hardware mouse cursor a software cursor will be implemented


function ConsoleDeviceGetPosition(Console:PConsoleDevice; Position:LongWord; var X1,Y1,X2,Y2:LongWord):LongWord;
Description: Get the coordinates of a console position from a console device
Console The console device to get from
Position The console position to get the coordinates for (eg CONSOLE_POSITION_FULL)
X1 The left edge of the console position (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Y1 The top edge of the console position (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
X2 The right edge of the console position (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Y2 The bottom edge of the console position (Pixels for CONSOLE_MODE_PIXEL / Characters for CONSOLE_MODE_CHARACTER)
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleDeviceGetProperties(Console:PConsoleDevice; Properties:PConsoleProperties):LongWord;
Description: Get the current properties from a console device
Console The console device to get properties from
Properties Pointer to a TConsoleProperties structure to return
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleDeviceCheckFlag(Console:PConsoleDevice; Flag:LongWord):Boolean;
Description: Check if a console device supports a flag value
Console The console device to check
Flag The console flag to check (eg CONSOLE_FLAG_FULLSCREEN)
Return True if flag is supported, False if not or on error.


function ConsoleDeviceUpdateFlag(Console:PConsoleDevice; Flag:LongWord; Clear:Boolean):LongWord;
Description: Set or clear a flag on a console device
Console The console device to set or clear the flag on
Flag The console flag to set or clear (eg CONSOLE_FLAG_LINE_WRAP)
Clear If true clear the flag, else set it.
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleDeviceGetMode(Console:PConsoleDevice):LongWord;
Description: Get the mode of a console device
Console The console device to get from
Return The mode of the console (eg CONSOLE_MODE_PIXEL) or CONSOLE_MODE_NONE on error


function ConsoleDeviceGetState(Console:PConsoleDevice):LongWord;
Description: Get the state of a console device
Console The console device to get from
Return The current state of the console (eg CONSOLE_STATE_OPEN)


function ConsoleDeviceCreate:PConsoleDevice;
Description: Create a new Console entry
Return Pointer to new Console entry or nil if Console could not be created


function ConsoleDeviceCreateEx(Size:LongWord):PConsoleDevice;
Description: Create a new Console entry
Size Size in bytes to allocate for new Console (Including the Console entry)
Return Pointer to new Console entry or nil if Console could not be created


function ConsoleDeviceDestroy(Console:PConsoleDevice):LongWord;
Description: Destroy an existing Console entry
Console The console device to destroy
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleDeviceRegister(Console:PConsoleDevice):LongWord;
Description: Register a new Console in the Console table
Console The console device to register
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleDeviceDeregister(Console:PConsoleDevice):LongWord;
Description: Deregister a Console from the Console table
Console The console device to deregister
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleDeviceFind(ConsoleId:LongWord):PConsoleDevice;
Description: Find a console device by ID in the console table
ConsoleId The ID number of the console to find
Return Pointer to console device entry or nil if not found


function ConsoleDeviceFindByDevice(Device:PDevice):PConsoleDevice;
Description: Find a console device by its related device in the console table
Device Pointer to the related device to find
Return Pointer to console device entry or nil if not found


function ConsoleDeviceFindByName(const Name:String):PConsoleDevice; inline;
Description: Find a console device by name in the console table
Name The name of the console to find (eg Console0)
Return Pointer to console device entry or nil if not found


function ConsoleDeviceFindByDescription(const Description:String):PConsoleDevice; inline;
Description: Find a console device by description in the console table
Description The description of the console to find (eg Framebuffer Console (Framebuffer0))
Return Pointer to console device entry or nil if not found


function ConsoleDeviceEnumerate(Callback:TConsoleEnumerate; Data:Pointer):LongWord;
Description: Enumerate all console devices in the console table
Callback The callback function to call for each console in the table
Data A private data pointer to pass to callback for each console in the table
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleDeviceNotification(Console:PConsoleDevice; Callback:TConsoleNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Description: Register a notification for console device changes
Console The console device to notify changes for (Optional, pass nil for all console devices)
Callback The function to call when a notification event occurs
Data A private data pointer to pass to callback when a notification event occurs
Notification The events to register for notification of (eg DEVICE_NOTIFICATION_REGISTER)
Flags The flags to control the notification (eg NOTIFIER_FLAG_WORKER)


Text console functions

function ConsoleWindowCreate(Console:PConsoleDevice; Position:LongWord; Default:Boolean):TWindowHandle;
Description: Create a new Console window
Console The console device to create the new window on
Position The console position to create the new window at (eg CONSOLE_POSITION_FULL)
Default If true allow the new window to be the default window if there is no current default
Return Handle to new Console window or INVALID_HANDLE_VALUE if Console window could not be created


function ConsoleWindowCreateEx(Console:PConsoleDevice; Font:TFontHandle; Size,State,Mode,Position:LongWord; Default:Boolean):TWindowHandle;
Description: Create a new Console window
Console The console device to create the new window on
Font The handle of the default font for the new console window
Size The size in bytes to allocate for the new window entry (Defaults to SizeOf(TConsoleWindow))
State Handle to new Console window or INVALID_HANDLE_VALUE if Console window could not be created
Mode The mode of the new console window (Normally WINDOW_MODE_TEXT)
Position The console position to create the new window at (eg CONSOLE_POSITION_FULL)
Default If true allow the new window to be the default window if there is no current default
Return Handle to new Console window or INVALID_HANDLE_VALUE if Console window could not be created


function ConsoleWindowDestroy(Handle:TWindowHandle):LongWord;
Description: Close and Destroy an existing console window
Handle The handle of the window to destroy
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowShow(Handle:TWindowHandle):LongWord;
Description: Make an existing console window visible and show it on screen
Handle The handle of the window to show
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowHide(Handle:TWindowHandle):LongWord;
Description: Make an existing console window invisible and hide it on screen
Handle The handle of the window to hide
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowActivate(Handle:TWindowHandle):LongWord;
Description: Make an existing console window the active window
Handle The handle of the window to activate
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowDeactivate(Handle:TWindowHandle):LongWord;
Description: Make an existing console window inactive
Handle The handle of the window to deactivate
Return ERROR_SUCCESS if completed or another error code on failure
Note On success there will be no active window set


function ConsoleWindowNext(Console:PConsoleDevice; Visible:Boolean):TWindowHandle;
Description: Get the next console window starting with the active window
Console The console device to change the active window on
Visible If true only return windows that are visible
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowPrevious(Console:PConsoleDevice; Visible:Boolean):TWindowHandle;
Description: Get the previous console window starting with the active window
Console The console device to change the active window on
Visible If true only return windows that are visible
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowAt(Console:PConsoleDevice; X,Y:LongWord; Visible:Boolean):TWindowHandle;
Description: Find the console window that X and Y coordinates are within
Console The console device to find the window on
X The X coordinate to find the window for
Y The Y coordinate to find the window for
Visible If true only return windows that are visible
Return ERROR_SUCCESS if completed or another error code on failure
Note For Text Console functions, X and Y are based on character columns not screen pixels.


function ConsoleWindowFind(Console:PConsoleDevice; Position:LongWord):TWindowHandle;
Description: Find an existing console window in the position specified
Console The console device to find the window on
Position The window position to find (eg CONSOLE_POSITION_FULL)
Return The handle of the existing window or INVALID_HANDLE_VALUE if not found


function ConsoleWindowEnumerate(Console:PConsoleDevice; Callback:TConsoleWindowEnumerate; Data:Pointer):LongWord;
Description: Enumerate existing console windows on the specified console device
Console The console device to enumerate windows for
Callback The function to call for each window enumerated
Data A pointer to private data to be passed to the callback (Optional)
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowCheckFlag(Handle:TWindowHandle; Flag:LongWord):Boolean;
Description: Check an existing console window to determine if a flag is set or not
Handle The handle of the window to check
Flag The window flag to check for (eg WINDOW_FLAG_LINE_WRAP)
Return True if the flag is set, False if not set.


function ConsoleWindowUpdateFlag(Handle:TWindowHandle; Flag:LongWord; Clear:Boolean):LongWord;
Description: Set or clear a flag on an existing console window
Handle The handle of the window to set or clear the flag on
Flag The window flag to set or clear (eg WINDOW_FLAG_LINE_WRAP)
Clear If true clear the flag, else set it
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowGetMode(Handle:TWindowHandle):LongWord;
Description: Get the window mode of an existing console window
Handle The handle of the window to get the mode for
Return The window mode (eg WINDOW_MODE_TEXT)


function ConsoleWindowGetState(Handle:TWindowHandle):LongWord;
Description: Get the window state of an existing console window
Handle The handle of the window to get the state for
Return The window state (eg WINDOW_STATE_INVISIBLE)


function ConsoleWindowGetPosition(Handle:TWindowHandle):LongWord;
Description: Get the position of an existing console window
Handle The handle of the window to get the position for
Return The window position (eg CONSOLE_POSITION_FULL)


function ConsoleWindowSetPosition(Handle:TWindowHandle; Position:LongWord):LongWord;
Description: Set the position of an existing console window
Handle The handle of the window to set the position for
Position The new window position to set
Return ERROR_SUCCESS if completed or another error code on failure
Note The function will return ERROR_INVALID_PARAMETER if another window exists at the position


function ConsoleWindowGetProperties(Handle:TWindowHandle; Properties:PWindowProperties):LongWord;
Description: Get the properties for the specified console window
Handle The handle of the window to get the properties from
Properties Pointer to a TWindowProperties structure to fill in
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowGetMinX(Handle:TWindowHandle):LongWord;
Description: Get the current minimum X of the window viewport for an existing console window
Handle The handle of the window to get MinX for
Return The minimum X value for the current window viewport
Note For Text Console functions, X is based on character columns not screen pixels.


function ConsoleWindowGetMinY(Handle:TWindowHandle):LongWord;
Description: Get the current minimum Y of the window viewport for an existing console window
Handle The handle of the window to get MinY for
Return The minimum Y value for the current window viewport
Note For Text Console functions, Y is based on character rows not screen pixels.


function ConsoleWindowGetMaxX(Handle:TWindowHandle):LongWord;
Description: Get the current maximum X of the window viewport for an existing console window
Handle The handle of the window to get MaxX for
Return The maximum X value for the current window viewport
Note For Text Console functions, X is based on character columns not screen pixels.


function ConsoleWindowGetMaxY(Handle:TWindowHandle):LongWord;
Description: Get the current maximum Y of the window viewport for an existing console window
Handle The handle of the window to get MaxY for
Return The maximum Y value for the current window viewport
Note For Text Console functions, Y is based on character rows not screen pixels.


function ConsoleWindowGetRect(Handle:TWindowHandle):TConsoleRect; inline;
Description: Get the rectangle X1,Y1,X2,Y2 of the window viewport for an existing console window
Handle The handle of the window to get the rectangle for
Return The rectangle of the current window viewport
Note For Text Console functions, Rect is based on character rows and columns not screen pixels.


function ConsoleWindowSetRect(Handle:TWindowHandle; const ARect:TConsoleRect):LongWord; inline;
Description: Set the rectangle X1,Y1,X2,Y2 of the window viewport for an existing console window
Handle The handle of the window to set the rectangle for
Rect The rectangle to set for the window viewport
Return ERROR_SUCCESS if completed or another error code on failure
Note For Text Console functions, Rect is based on character rows and columns not screen pixels.


function ConsoleWindowResetRect(Handle:TWindowHandle):LongWord; inline;
Description: Reset the window viewport for an existing console window to the maximum size
Handle The handle of the window to reset the viewport for
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowGetViewport(Handle:TWindowHandle; var X1,Y1,X2,Y2:LongWord):LongWord;
Description: Get the X1,Y1,X2,Y2 of the window viewport for an existing console window
Handle The handle of the window to get the viewport for
X1 The left edge of the current viewport
Y1 The top edge of the current viewport
X2 The right edge of the current viewport
Y2 The bottom edge of the current viewport
Return ERROR_SUCCESS if completed or another error code on failure
Note For Text Console functions, Viewport is based on character rows and columns not screen pixels.


function ConsoleWindowSetViewport(Handle:TWindowHandle; X1,Y1,X2,Y2:LongWord):LongWord;
Description: Set the X1,Y1,X2,Y2 of the window viewport for an existing console window
Handle The handle of the window to get the viewport for
X1 The left edge of the window viewport
Y1 The top edge of the window viewport
X2 The right edge of the window viewport
Y2 The bottom edge of the window viewport
Return ERROR_SUCCESS if completed or another error code on failure
Note For Text Console functions, Viewport is based on character rows and columns not screen pixels.


function ConsoleWindowResetViewport(Handle:TWindowHandle):LongWord;
Description: Reset the window viewport for an existing console window to the maximum size
Handle The handle of the window to reset the viewport for
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowGetX(Handle:TWindowHandle):LongWord;
Description: Get the current X (Column) position of an existing console window
Handle The handle of the window to get X for
Return The X value for the window
Note For Text Console functions, X is based on character columns not screen pixels.


function ConsoleWindowSetX(Handle:TWindowHandle; X:LongWord):LongWord;
Description: Set the current X (Column) position of an existing console window
Handle The handle of the window to set X for
X The new X value to set
Return ERROR_SUCCESS if completed or another error code on failure
Note For Text Console functions, X is based on character columns not screen pixels.


function ConsoleWindowGetY(Handle:TWindowHandle):LongWord;
Description: Get the current Y (Row) position of an existing console window
Handle The handle of the window to get Y for
Return The Y value for the window
Note For Text Console functions, Y is based on character rows not screen pixels.


function ConsoleWindowSetY(Handle:TWindowHandle; Y:LongWord):LongWord;
Description: Set the current Y (Row) position of an existing console window
Handle The handle of the window to set Y for
Y The new Y value to set
Return ERROR_SUCCESS if completed or another error code on failure
Note For Text Console functions, Y is based on character rows not screen pixels.


function ConsoleWindowGetXY(Handle:TWindowHandle; var X,Y:LongWord):LongWord;
Description: Get the current X and Y positions of an existing console window
Handle The handle of the window to get X and Y for
X The returned X value
Y The returned Y value
Return ERROR_SUCCESS if completed or another error code on failure
Note For Text Console functions, X and Y are based on character rows and columns not screen pixels.


function ConsoleWindowSetXY(Handle:TWindowHandle; X,Y:LongWord):LongWord;
Description: Set the current X and Y positions of an existing console window
Handle The handle of the window to set X and Y for
X The new X value
Y The new Y value
Return ERROR_SUCCESS if completed or another error code on failure
Note For Text Console functions, X and Y are based on character rows and columns not screen pixels.


function ConsoleWindowGetPoint(Handle:TWindowHandle):TConsolePoint;
Description: Get the point X,Y of an existing console window
Handle The handle of the window to get the point for
Return The current point of the window
Note For Text Console functions, Point is based on character rows and columns not screen pixels.


function ConsoleWindowSetPoint(Handle:TWindowHandle; const APoint:TConsolePoint):LongWord;
Description: Set the point X,Y of an existing console window
Handle The handle of the window to set the point for
Point The new point to set for the window
Return ERROR_SUCCESS if completed or another error code on failure
Note For Text Console functions, Point is based on character rows and columns not screen pixels.


function ConsoleWindowGetCols(Handle:TWindowHandle):LongWord;
Description: Get the current columns of the window viewport for an existing console window
Handle The handle of the window to get columns for
Return The columns value for the current window viewport
Note For Text Console functions, Columns is based on character columns not screen pixels.


function ConsoleWindowGetRows(Handle:TWindowHandle):LongWord;
Description: Get the current rows of the window viewport for an existing console window
Handle The handle of the window to get rows for
Return The rows value for the current window viewport
Note For Text Console functions, Rows is based on character rows not screen pixels.


function ConsoleWindowGetWidth(Handle:TWindowHandle):LongWord;
Description: Get the absolute width of an existing console window
Handle The handle of the window to get the width for
Return The absolute width of the window
Note For Text Console functions, Width is based on character columns not screen pixels.


function ConsoleWindowGetHeight(Handle:TWindowHandle):LongWord;
Description: Get the absolute height of an existing console window
Handle The handle of the window to get the height for
Return The absolute height of the window
Note For Text Console functions, Height is based on character rows not screen pixels.


function ConsoleWindowGetFormat(Handle:TWindowHandle):LongWord;
Description: Get the color format of an existing console window
Handle The handle of the window to get the format for
Return The color format of the window (eg COLOR_FORMAT_ARGB32)


function ConsoleWindowGetForecolor(Handle:TWindowHandle):LongWord;
Description: Get the current foreground color of an existing console window
Handle The handle of the window to get the foreground color for
Return The foreground color of the window (eg COLOR_WHITE)


function ConsoleWindowSetForecolor(Handle:TWindowHandle; Color:LongWord):LongWord;
Description: Set the current foreground color of an existing console window
Handle The handle of the window to set the foreground color for
Color The foreground color to set (eg COLOR_WHITE)
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowGetBackcolor(Handle:TWindowHandle):LongWord;
Description: Get the current background color of an existing console window
Handle The handle of the window to get the background color for
Return The background color of the window (eg COLOR_BLACK)


function ConsoleWindowSetBackcolor(Handle:TWindowHandle; Color:LongWord):LongWord;
Description: Set the current background color of an existing console window
Handle The handle of the window to set the background color for
Color The background color to set (eg COLOR_BLACK)
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowGetFont(Handle:TWindowHandle):TFontHandle;
Description: Get the default font of an existing console window
Handle The handle of the window to get the default font for
Return The font handle of the default font or INVALID_HANDLE_VALUE on error


function ConsoleWindowSetFont(Handle:TWindowHandle; Font:TFontHandle):LongWord;
Description: Set the default font of an existing console window
Handle The handle of the window to set the default font for
Font The font handle of the default font to set
Return ERROR_SUCCESS if completed or another error code on failure
Note For Text Console windows, setting the font also clears the window.


function ConsoleWindowGetCursorXY(Handle:TWindowHandle; var X,Y:LongWord):LongWord;
Description: Get the current cursor X and Y positions of an existing console window
Handle The handle of the window to get cursor X and Y for
X The returned cursor X value
Y The returned cursor Y value
Return ERROR_SUCCESS if completed or another error code on failure
Note For Text Console functions, cursor X and Y are based on character rows and columns not screen pixels.


function ConsoleWindowSetCursorXY(Handle:TWindowHandle; X,Y:LongWord):LongWord;
Description: Set the current cursor X and Y positions of an existing console window
Handle The handle of the window to set cursor X and Y for
X The new cursor X value
Y The new cursor Y value
Return ERROR_SUCCESS if completed or another error code on failure
Note For Text Console functions, cursor X and Y are based on character rows and columns not screen pixels.


function ConsoleWindowGetCursorMode(Handle:TWindowHandle):TCursorMode;
Description: Get the current cursor mode of an existing console window
Handle The handle of the window to get the mode for
Return The current cursor mode (eg CURSOR_MODE_INSERT)


function ConsoleWindowSetCursorMode(Handle:TWindowHandle;CursorMode:TCursorMode):LongWord;
Description: Set the current cursor mode of an existing console window
Handle The handle of the window to set the mode for
CursorMode The cursor mode to set (eg CURSOR_MODE_INSERT)
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowGetCursorBlink(Handle:TWindowHandle):Boolean;
Description: Get the current cursor blink state of an existing console window
Handle The handle of the window to get blink state for
Return True if blink is enabled, False if not or on error.


function ConsoleWindowSetCursorBlink(Handle:TWindowHandle; CursorBlink:Boolean):LongWord;
Description: Set the current cursor blink state of an existing console window
Handle The handle of the window to set the blink state for
CursorBlink True to enable blink, False to disable.
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowGetCursorState(Handle:TWindowHandle):TCursorState;
Description: Get the current cursor state of an existing console window
Handle The handle of the window to get the state for
Return The current cursor state (eg CURSOR_STATE_ON)


function ConsoleWindowSetCursorState(Handle:TWindowHandle; CursorState:TCursorState):LongWord;
Description: Set the current cursor state of an existing console window
Handle The handle of the window to set the state for
CursorState The cursor state to set (eg CURSOR_STATE_ON)
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowGetCursorShape(Handle:TWindowHandle):TCursorShape;
Description: Get the current cursor shape of an existing console window
Handle The handle of the window to get the shape for
Return The current cursor shape (eg CURSOR_SHAPE_LINE)


function ConsoleWindowSetCursorShape(Handle:TWindowHandle; CursorShape:TCursorShape):LongWord;
Description: Set the current cursor shape of an existing console window
Handle The handle of the window to set the shape for
CursorShape The cursor shape to set (eg CURSOR_SHAPE_LINE)
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowGetCursorColor(Handle:TWindowHandle):LongWord;
Description: Get the current cursor color of an existing console window
Handle The handle of the window to get cursor color for
Return The cursor color of the window (eg COLOR_WHITE)
Note Color will be returned in the default color format (See COLOR_FORMAT_DEFAULT)


function ConsoleWindowSetCursorColor(Handle:TWindowHandle; Color:LongWord):LongWord;
Description: Set the current cursor color of an existing console window
Handle The handle of the window to set the cursor color for
Color The cursor color to set (eg COLOR_WHITE)
Return ERROR_SUCCESS if completed or another error code on failure
Note Color must be specified in the default color format (See COLOR_FORMAT_DEFAULT)


function ConsoleWindowGetCursorReverse(Handle:TWindowHandle):Boolean;
Description: Get the current cursor reverse state of an existing console window
Handle The handle of the window to get reverse state for
Return True if reverse color is enabled, False if inverse color is enabled


function ConsoleWindowSetCursorReverse(Handle:TWindowHandle; CursorReverse:Boolean):LongWord;
Description: Set the current cursor reverse state of an existing console window
Handle The handle of the window to set the reverse state for
CursorReverse True to enable reverse color, False to enable inverse color
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowCursorOn(Handle:TWindowHandle):LongWord;
Description: Enable the cursor on an existing console window
Handle The handle of the window to enable the cursor for
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowCursorOff(Handle:TWindowHandle):LongWord;
Description: Disable the cursor on an existing console window
Handle The handle of the window to disable the cursor for
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowCursorLine(Handle:TWindowHandle):LongWord;
Description: Change the cursor to a vertical line on an existing console window
Handle The handle of the window to change the cursor for
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowCursorBar(Handle:TWindowHandle):LongWord;
Description: Change the cursor to a horizontal bar on an existing console window
Handle The handle of the window to change the cursor for
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowCursorBlock(Handle:TWindowHandle):LongWord;
Description: Change the cursor to a solid block on an existing console window
Handle The handle of the window to change the cursor for
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowCursorMove(Handle:TWindowHandle; X,Y:LongWord):LongWord;
Description: Move the cursor on an existing console window
Handle The handle of the window to move the cursor for
X The column to move the cursor to
Y The row to move the cursor to
Return ERROR_SUCCESS if completed or another error code on failure
Note For Text Console functions, X and Y are based on character rows and columns not screen pixels.


function ConsoleWindowCursorBlink(Handle:TWindowHandle; Enabled:Boolean):LongWord;
Description: Set the blink state of the cursor on an existing console window
Handle The handle of the window to set the blink state for
Enabled True if the cursor is blinking, False if not
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowCursorColor(Handle:TWindowHandle; Color:LongWord):LongWord;
Description: Set the color of the cursor on an existing console window
Handle The handle of the window to set the color for
Color The cursor color to set (eg COLOR_WHITE)
Return ERROR_SUCCESS if completed or another error code on failure
Note Color must be specified in the default color format (See COLOR_FORMAT_DEFAULT)


function ConsoleWindowCursorReverse(Handle:TWindowHandle; Enabled:Boolean):LongWord;
Description: Set the reverse state of the cursor on an existing console window
Handle The handle of the window to set the reverse state for
Enabled True if the cursor shows in reverse colors, False if it shows in inverse colors
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowAddHistory(Handle:TWindowHandle; const Value:String):LongWord;
Description: Add a value to the command history table of an existing console window
Handle The handle of the window to add to
Value The text to add to the command history
Return ERROR_SUCCESS if completed or another error code on failure
Note For Text Console functions, Window is based on screen character rows and columns not screen pixels

When the number of entries in the table reaches the maximum the first entry will be removed


function ConsoleWindowClearHistory(Handle:TWindowHandle):LongWord;
Description: Remove all entries from the command history table of an existing console window}
Handle The handle of the window to clear
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowFirstHistory(Handle:TWindowHandle):String;
Description: Get the first (oldest) command history value from an existing console window
Handle The handle of the window to get from
Return The command history value or an empty string on failure


function ConsoleWindowLastHistory(Handle:TWindowHandle):String;
Description: Get the last (most recent) command history value from an existing console window
Handle The handle of the window to get from
Return The command history value or an empty string on failure


function ConsoleWindowNextHistory(Handle:TWindowHandle):String;
Description: Get the next (after current) command history value from an existing console window
Handle The handle of the window to get from
Return The command history value or an empty string on failure


function ConsoleWindowPreviousHistory(Handle:TWindowHandle):String;
Description: Get the next (before current) command history value from an existing console window
Handle The handle of the window to get from
Return The command history value or an empty string on failure
Note If there is no current history value the last value is returned


function ConsoleWindowCurrentHistory(Handle:TWindowHandle):String;
Description: Get the current command history value from an existing console window
Handle The handle of the window to get from
Return The command history value or an empty string on failure
Note If there is no current history value the last value is returned


function ConsoleWindowScrollUp(Handle:TWindowHandle; Row,Lines:LongWord):LongWord;
Description: Scroll the current viewport of an existing console window up
Handle The handle of the window to scroll
Row The starting row (Y) for the scroll up, all rows from top plus Lines down to Row will be scrolled up.
Lines The number of character lines to scroll up, Lines number of rows at the top will be discarded.
Return ERROR_SUCCESS if completed or another error code on failure
Note Row is the starting row (Y) for the scroll up, all rows from top plus Lines down to Row will be scrolled up. Lines is the number of character lines to scroll up, Lines number of rows at the top will be discarded. The starting Row will be blanked with the background color.


function ConsoleWindowScrollDown(Handle:TWindowHandle; Row,Lines:LongWord):LongWord;
Description: Scroll the current viewport of an existing console window down
Handle The handle of the window to scroll
Row The starting row (Y) for the scroll down, all rows from bottom minus Lines up to Row will be scrolled down.
Lines The number of character lines to scroll down, Lines number of rows at the bottom will be discarded.
Return ERROR_SUCCESS if completed or another error code on failure
Note Row is the starting row (Y) for the scroll down, all rows from bottom minus Lines up to Row will be scrolled down. Lines is the number of character lines to scroll down, Lines number of rows at the bottom will be discarded. The starting Row will be blanked with the background color.


function ConsoleWindowScrollLeft(Handle:TWindowHandle; Row,Col,Lines,Chars:LongWord):LongWord;
Description: Scroll the current viewport of an existing console window left
Handle The handle of the window to scroll
Row The starting row (Y) for the scroll left, all rows from Row down to Row + Lines will be scrolled left.
Lines The number of rows to scroll left, all rows from Row down to Row + Lines will be scrolled left.
Col The starting column (X) for the scroll left, all cols from left plus Chars to Col with be scrolled left.
Char The number of characters to scroll left, Chars number of columns at the left will be discarded.
Return ERROR_SUCCESS if completed or another error code on failure
Note The starting Col will be blanked with the background color


function ConsoleWindowScrollRight(Handle:TWindowHandle; Row,Col,Lines,Chars:LongWord):LongWord;
Description: Scroll the current viewport of an existing console window right
Handle The handle of the window to scroll
Row The starting row (Y) for the scroll right, all rows from Row down to Row + Lines will be scrolled right.
Lines The number of rows to scroll right, all rows from Row down to Row + Lines will be scrolled right.
Col The starting column (X) for the scroll right, all rows from right minus Chars to Col will be scrolled right.
Char The number of characters to scroll right, Chars number of columns at the right will be discarded.
Return ERROR_SUCCESS if completed or another error code on failure
Note The starting Col will be blanked with the background color


function ConsoleWindowClear(Handle:TWindowHandle):LongWord;
Description: Clear the current viewport of an existing console window
Handle The handle of the window to clear
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowClearEx(Handle:TWindowHandle; X1,Y1,X2,Y2:LongWord; Cursor:Boolean):LongWord;
Description: Clear part of the the current viewport of an existing console window
Handle The handle of the window to clear
X1 The left edge of the area to clear (relative to current viewport)
Y1 The top edge of the area to clear (relative to current viewport)
X2 The right edge of the area to clear (relative to current viewport)
Y2 The bottom edge of the area to clear (relative to current viewport)
Cursor If True update the cursor position after clearing
Return ERROR_SUCCESS if completed or another error code on failure
Note For Text Console functions, Window is based on screen character rows and columns not screen pixels.


function ConsoleWindowWrite(Handle:TWindowHandle; const AText:String):LongWord;
Description: Write text on an existing console window at the current position in the current color
Handle The handle of the window to write text on
Text The text to write
Return ERROR_SUCCESS if completed or another error code on failure
Note The window will not scroll up at the end of the line


function ConsoleWindowWriteEx(Handle:TWindowHandle; const AText:String; X,Y,Forecolor,Backcolor:LongWord):LongWord;
Description: Write text on an existing console window
Handle The handle of the window to write text on
Text The text to write
X The column to start writing the text at
Y The row to start writing the text at
Forecolor The foreround color to use (eg COLOR_WHITE)
Backcolor The foreround color to use (eg COLOR_BLACK)
Return ERROR_SUCCESS if completed or another error code on failure
Note For Text Console functions, X and Y are based on screen character rows and columns not screen pixels.

The window will not scroll up at the end of the line


function ConsoleWindowWriteLn(Handle:TWindowHandle; const AText:String):LongWord;
Description: Write text on an existing console window at the current position in the current color
Handle The handle of the window to write text on
Text The text to write
Return ERROR_SUCCESS if completed or another error code on failure
Note The window will scroll up at the end of the line


function ConsoleWindowWriteLnEx(Handle:TWindowHandle; const AText:String; X,Y,Forecolor,Backcolor:LongWord):LongWord;
Description: Write text on an existing console window
Handle The handle of the window to write text on
Text The text to write
X The column to start writing the text at
Y The row to start writing the text at
Forecolor The foreround color to use (eg COLOR_WHITE)
Backcolor The foreround color to use (eg COLOR_BLACK)
Return ERROR_SUCCESS if completed or another error code on failure
Note For Text Console functions, X and Y are based on character rows and columns not screen pixels.

The window will scroll up at the end of the line


function ConsoleWindowWriteChr(Handle:TWindowHandle; AChr:Char):LongWord;
Description: Write a character on an existing console window at the current position in the current color
Handle The handle of the window to write the character on
Chr The character to write
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowWriteChrEx(Handle:TWindowHandle; AChr:Char; X,Y,Forecolor,Backcolor:LongWord):LongWord;
Description: Write a character on an existing console window
Handle The handle of the window to write the character on
Chr The character to write
X The column to start writing the character at
Y The row to start writing the character at
Forecolor The foreround color to use (eg COLOR_WHITE)
Backcolor The foreround color to use (eg COLOR_BLACK)
Return ERROR_SUCCESS if completed or another error code on failure
Note For Text Console functions, X and Y are based on character rows and columns not screen pixels.


function ConsoleWindowOutput(Handle:TWindowHandle; const Source,Dest:TConsolePoint; Buffer:PConsoleChar; Width,Height,Skip:LongWord):LongWord;
Description: Output a rectangular area of text to a console window
Handle The console window to output to
Source The X and Y point in the source buffer to copy text from (Characters)
Dest The X and Y point on the console window to copy text to (Characters)
Buffer A pointer to a buffer of TConsoleChar structures which represent rows of text
Width The width of the area to be output (Characters)
Height The height of the area to be output (Characters)
Skip The number of characters to skip in the buffer after each row (Optional)
Return ERROR_SUCCESS if completed or another error code on failure
Note For Text Console functions, Source, Dest, Width, Height and Skip are based on character rows and columns not screen pixels.


function ConsoleWindowRead(Handle:TWindowHandle; var AText:String):LongWord;
Description: Read text input from the console and echo to an existing console window at the current position in the current color
Handle The handle of the window to echo input to
Text The text read from the console on return
Return ERROR_SUCCESS if completed or another error code on failure
Note The console window will not scroll up on return


function ConsoleWindowReadLn(Handle:TWindowHandle; var AText:String):LongWord;
Description: Read text input from the console and echo to an existing console window at the current position in the current color
Handle The handle of the window to echo input to
Text The text read from the console on return
Return ERROR_SUCCESS if completed or another error code on failure
Note The console window will scroll up one line on return


function ConsoleWindowReadLnEx(Handle:TWindowHandle; var AText:String; const Prompt:String; X,Y,Forecolor,Backcolor:LongWord; Scroll,History:Boolean; Completion:TConsoleWindowCompletion; Data:Pointer):LongWord;
Description: Read text input from the console and echo to an existing console window at the specified position in the specified color
Handle The handle of the window to echo input to
Text The text read from the console on return
Prompt An optional text prompt to display at the start of the line
X The starting X position for the output (0 for current position)
Y The starting Y position for the output (0 for current position)
Forecolor The text forecolor for the output (COLOR_NONE for current color)
Backcolor The text backcolor for the output (COLOR_NONE for current color)
Scroll If true then scroll up one line on return
History If true then support console history buffer using Up, Down and F3 keys
Return ERROR_SUCCESS if completed or another error code on failure
Note Supports common line editing behaviour including Home, End, Left, Right, Up, Down, Insert, Backspace and Delete.


function ConsoleWindowReadChr(Handle:TWindowHandle; var AChr:Char):LongWord;
Description: Read one character input from the console and echo to an existing console window at the current position in the current color
Handle The handle of the window to echo input to
Chr The character read from the console on return
Return ERROR_SUCCESS if completed or another error code on failure
Note The console window will not scroll up on return


function ConsoleWindowReadChrEx(Handle:TWindowHandle; var AChr:Char; const Prompt:String; X,Y,Forecolor,Backcolor:LongWord; Echo,Scroll:Boolean):LongWord;
Description: Read one character input from the console and optionally echo to an existing console window at the specified position in the specified color
Handle The handle of the window to echo input to
Chr The character read from the console on return
Prompt An optional text prompt to display at the start of the line
X The starting X position for the output (0 for current position)
Y The starting Y position for the output (0 for current position)
Forecolor The text forecolor for the output (COLOR_NONE for current color)
Backcolor The text backcolor for the output (COLOR_NONE for current color)
Echo If true then echo the character to the console window
Scroll If true then scroll up one line on return
Return ERROR_SUCCESS if completed or another error code on failure


CRT console functions

procedure ConsoleAssignCrt(var F:Text);
Description: Compatible with RTL Crt unit function AssignCrt


procedure ConsoleClrEol;
Description: Compatible with RTL Crt unit function ClrEol


procedure ConsoleClrScr;
Description: Compatible with RTL Crt unit function ClrScr


procedure ConsoleDelay(MS:Word);
Description: Compatible with RTL Crt unit function Delay


procedure ConsoleDelLine;
Description: Compatible with RTL Crt unit function DelLine


procedure ConsoleGotoXY(X,Y:Integer);
Description: Compatible with RTL Crt unit function GotoXY
See http://www.freepascal.org/docs-html-3.0.0/rtl/crt/gotoxy.html
Note For CRT Console functions, X and Y are based on character rows and columns not screen pixels.


procedure ConsoleHighVideo;
Description: Compatible with RTL Crt unit function HighVideo


procedure ConsoleInsLine;
Description: Compatible with RTL Crt unit function InsLine


function ConsoleKeypressed:Boolean;
Description: Compatible with RTL Crt unit function KeyPressed


procedure ConsoleLowVideo;
Description: Compatible with RTL Crt unit function LowVideo


procedure ConsoleNormVideo;
Description: Compatible with RTL Crt unit function NormVideo


procedure ConsoleNoSound;
Description: Compatible with RTL Crt unit function NoSound


function ConsoleReadKey:Char;
Description: Compatible with RTL Crt unit function ReadKey


procedure ConsoleSound(Hz:Word);
Description: Compatible with RTL Crt unit function Sound


procedure ConsoleTextBackground(Color:LongWord);
Description: Compatible with RTL Crt unit function TextBackground


procedure ConsoleTextColor(Color:LongWord);
Description: Compatible with RTL Crt unit function TextColor


procedure ConsoleTextMode(Mode:Integer);
Description: Compatible with RTL Crt unit function TextMode


function ConsoleWhereX:Integer;
Description: Compatible with RTL Crt unit function WhereX
See http://www.freepascal.org/docs-html-3.0.0/rtl/crt/wherex.html
Note For CRT Console functions, X is based on character columns not screen pixels.


function ConsoleWhereY:Integer;
Description: Compatible with RTL Crt unit function WhereY
See http://www.freepascal.org/docs-html-3.0.0/rtl/crt/wherey.html
Note For CRT Console functions, Y is based on character row not screen pixel.


procedure ConsoleWindow(X1,Y1,X2,Y2:Integer);
Description: Compatible with RTL Crt unit function Window
See http://www.freepascal.org/docs-html-3.0.0/rtl/crt/window.html
Note For CRT Console functions, X1, Y1, X2 and Y2 are based on character rows and columns not screen pixels.


procedure ConsoleScrollUp(Row,Lines:Integer);
Description: Scroll the default console window up
Row The starting row (Y) for the scroll up, all rows from top plus Lines down to Row will be scrolled up.
Lines The number of character lines to scroll up, Lines number of rows at the top will be discarded.
Note For CRT Console functions, Row and Lines are based on character rows and columns not screen pixels.


procedure ConsoleScrollDown(Row,Lines:Integer);
Description: Scroll the default console window down
Row The starting row (Y) for the scroll down, all rows from bottom minus Lines up to Row will be scrolled down.
Lines The number of character lines to scroll down, Lines number of rows at the bottom will be discarded.
Note For CRT Console functions, Row and Lines are based on character rows and columns not screen pixels.


procedure ConsoleWrite(const AText:String);
Description: Write text on the default console window at the current position in the current color
Text The text to write
Note The window will not scroll up at the end of the line


procedure ConsoleWriteLn(const AText:String);
Description: Write text on the default console window at the current position in the current color
Text The text to write
Note The window will scroll up at the end of the line


procedure ConsoleWriteChr(AChr:Char);
Description: Write a character on the default console window at the current position in the current color
Chr The character to write


procedure ConsoleRead(var AText:String);
Description: Read text from console input and echo to screen
Text The text read from the console input


procedure ConsoleReadLn(var AText:String);
Description: Read text from console input and echo to screen
Text The text read from the console input


procedure ConsoleReadChr(var AChr:Char);
Description: Read characters from console input and echo to screen
Chr The character read from the console input


RTL text IO functions

function SysTextIOWriteChar(ACh:Char; AUserData:Pointer):Boolean;
Description: Handler for platform TextIOWriteChar function
Note Not intended to be called directly by applications


RTL console functions

function SysConsoleWriteChar(ACh:Char; AUserData:Pointer):Boolean;
Description: Handler for platform ConsoleWriteChar function
Note Not intended to be called directly by applications


Framebuffer console functions

function FramebufferConsoleOpen(Console:PConsoleDevice):LongWord;
Description: Implementation of ConsoleDeviceOpen API for FramebufferConsole
Note Not intended to be called directly by applications, use ConsoleDeviceOpen instead


function FramebufferConsoleClose(Console:PConsoleDevice):LongWord;
Description: Implementation of ConsoleDeviceClose API for FramebufferConsole
Note Not intended to be called directly by applications, use ConsoleDeviceClose instead


function FramebufferConsoleClear(Console:PConsoleDevice; Color:LongWord):LongWord;
Description: Implementation of ConsoleDeviceClear API for FramebufferConsole
Note Not intended to be called directly by applications, use ConsoleDeviceClear instead


function FramebufferConsoleScroll(Console:PConsoleDevice; X1,Y1,X2,Y2,Count,Direction:LongWord):LongWord;
Description: Implementation of ConsoleDeviceScroll API for FramebufferConsole
Note Not intended to be called directly by applications, use ConsoleDeviceScroll instead


function FramebufferConsoleDrawBox(Console:PConsoleDevice; X1,Y1,X2,Y2,Color,Width:LongWord):LongWord;
Description: Implementation of ConsoleDeviceDrawBox API for FramebufferConsole
Note Not intended to be called directly by applications, use ConsoleDeviceDrawBox instead


function FramebufferConsoleDrawLine(Console:PConsoleDevice; X1,Y1,X2,Y2,Color,Width:LongWord):LongWord;
Description: Implementation of ConsoleDeviceDrawLine API for FramebufferConsole
Note Not intended to be called directly by applications, use ConsoleDeviceDrawLine instead


function FramebufferConsoleDrawChar(Console:PConsoleDevice; Handle:TFontHandle;Ch:Char; X,Y,Forecolor,Backcolor:LongWord):LongWord;
Description: Implementation of ConsoleDeviceDrawChar API for FramebufferConsole
Note Not intended to be called directly by applications, use ConsoleDeviceDrawChar instead


function FramebufferConsoleDrawText(Console:PConsoleDevice; Handle:TFontHandle; const Text:String; X,Y,Forecolor,Backcolor,Len:LongWord):LongWord;
Description: Implementation of ConsoleDeviceDrawText API for FramebufferConsole
Note Not intended to be called directly by applications, use ConsoleDeviceDrawText instead


function FramebufferConsoleDrawPixel(Console:PConsoleDevice; X,Y,Color:LongWord):LongWord;
Description: Implementation of ConsoleDeviceDrawPixel API for FramebufferConsole
Note Not intended to be called directly by applications, use ConsoleDeviceDrawPixel instead


function FramebufferConsoleDrawBlock(Console:PConsoleDevice; X1,Y1,X2,Y2,Color:LongWord):LongWord;
Description: Implementation of ConsoleDeviceDrawBlock API for FramebufferConsole
Note Not intended to be called directly by applications, use ConsoleDeviceDrawBlock instead


function FramebufferConsoleDrawImage(Console:PConsoleDevice; X,Y:LongWord; Buffer:Pointer; Width,Height,Format,Skip:LongWord):LongWord;
Description: Implementation of ConsoleDeviceDrawImage API for FramebufferConsole
Note Not intended to be called directly by applications, use ConsoleDeviceDrawImage instead


function FramebufferConsoleDrawWindow(Console:PConsoleDevice; Handle:TWindowHandle; Flags:LongWord):LongWord;
Description: Implementation of ConsoleDeviceDrawWindow API for FramebufferConsole
Note Not intended to be called directly by applications, use ConsoleDeviceDrawWindow instead

Caller must hold the Window lock


function FramebufferConsoleDrawDesktop(Console:PConsoleDevice):LongWord;
Description: Internal function used by FramebufferConsole to draw the console desktop
Note Not intended to be called directly by applications


function FramebufferConsoleGetPixel(Console:PConsoleDevice; X,Y:LongWord; var Color:LongWord):LongWord;
Description: Implementation of ConsoleDeviceGetPixel API for FramebufferConsole
Note Not intended to be called directly by applications, use ConsoleDeviceGetPixel instead


function FramebufferConsoleGetImage(Console:PConsoleDevice; X,Y:LongWord; Buffer:Pointer; Width,Height,Format,Skip:LongWord):LongWord;
Description: Implementation of ConsoleDeviceGetImage API for FramebufferConsole
Note Not intended to be called directly by applications, use ConsoleDeviceGetImage instead


function FramebufferConsolePutText(Console:PConsoleDevice; Handle:TFontHandle; const Source,Dest:TConsolePoint; Buffer:PConsoleChar; Width,Height,Skip:LongWord):LongWord;
Description: Implementation of ConsoleDevicePutText API for FramebufferConsole
Note Not intended to be called directly by applications, use ConsoleDevicePutText instead


function FramebufferConsoleCopyImage(Console:PConsoleDevice; const Source,Dest:TConsolePoint; Width,Height:LongWord):LongWord;
Description: Implementation of ConsoleDeviceCopyImage API for FramebufferConsole
Note Not intended to be called directly by applications, use ConsoleDeviceCopyImage instead


procedure FramebufferConsoleCaretTimer(Caret:PConsoleCaret);
Description: Internal function used by FramebufferConsole device
Note Not intended to be called directly by applications


procedure FramebufferConsoleShowCaret(Console:PConsoleDevice; Caret:PConsoleCaret);
Description: Internal function used by FramebufferConsole device
Note Not intended to be called directly by applications

Caller must hold the console lock


procedure FramebufferConsoleHideCaret(Console:PConsoleDevice; Caret:PConsoleCaret);
Description: Internal function used by FramebufferConsole device
Note Not intended to be called directly by applications

Caller must hold the console lock


function FramebufferConsoleAddCaret(Console:PConsoleDevice; Width,Height,OffsetX,OffsetY:LongWord):THandle;
Description: Implementation of ConsoleDeviceAddCaret API for FramebufferConsole
Note Not intended to be called directly by applications, use ConsoleDeviceAddCaret instead


function FramebufferConsoleDeleteCaret(Console:PConsoleDevice; Handle:THandle):LongWord;
Description: Implementation of ConsoleDeviceDeleteCaret API for FramebufferConsole
Note Not intended to be called directly by applications, use ConsoleDeviceDeleteCaret instead


function FramebufferConsoleUpdateCaretEx(Console:PConsoleDevice; Handle:THandle; X,Y,Forecolor,Backcolor:LongWord; Visible,Blink,Reverse:Boolean):LongWord;
Description: Implementation of ConsoleDeviceUpdateCaretEx API for FramebufferConsole
Note Not intended to be called directly by applications, use ConsoleDeviceUpdateCaretEx instead


function FramebufferConsoleGetPosition(Console:PConsoleDevice; Position:LongWord; var X1,Y1,X2,Y2:LongWord):LongWord;
Description: Implementation of ConsoleDeviceGetPosition API for FramebufferConsole
Note Not intended to be called directly by applications, use ConsoleDeviceGetPosition instead


Console helper functions

function ConsoleDeviceGetCount:LongWord;
Description: Get the current console device count
Note None documented


function ConsoleDeviceGetDefault:PConsoleDevice;
Description: Get the current default console device
Note None documented


function ConsoleDeviceSetDefault(Console:PConsoleDevice):LongWord;
Description: Set the current default console device
Note None documented


function ConsoleDeviceCheck(Console:PConsoleDevice):PConsoleDevice;
Description: Check if the supplied Console device is in the Console table
Note None documented


function ConsoleDeviceCaretCheck(Console:PConsoleDevice; Caret:PConsoleCaret):PConsoleCaret;
Description: Check if a console caret entry is valid
Console The console device to search for the caret
Caret The caret entry to check for validity
Return The supplied caret if successful or nil on failure


function ConsoleTypeToString(ConsoleType:LongWord):String;
Description: Convert a Console type value to a string
Note None documented


function ConsoleStateToString(ConsoleState:LongWord):String;
Description: Convert a Console state value to a string
Note None documented


function ConsoleDeviceGetDefaultFont:TFontHandle;
Description: Get the default console font
Note None documented


function ConsolePositiontoString(Position:LongWord):String;
Description: To be documented
Note None documented


function ConsoleFramebufferDeviceAdd(Framebuffer:PFramebufferDevice):LongWord;
Description: To be documented
Note None documented


function ConsoleFramebufferDeviceRemove(Framebuffer:PFramebufferDevice):LongWord;
Description: To be documented
Note None documented


function ConsoleFramebufferDeviceEnum(Framebuffer:PFramebufferDevice; Data:Pointer):LongWord;
Description: To be documented
Note None documented


function ConsoleFramebufferDeviceNotify(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;
Description: To be documented
Note None documented


Text console helper functions

function ConsoleWindowGetCount(Console:PConsoleDevice):LongWord; inline;
Description: Get the current console window count
Console The console device to get the window count for
Return The current number of console windows on the specified console device


function ConsoleWindowGetActive(Console:PConsoleDevice):TWindowHandle; inline;
Description: Get the current console active window
Console The console device to get the active window for
Return The window handle of the current active window or INVALID_HANDLE_VALUE on failure


function ConsoleWindowGetDefault(Console:PConsoleDevice):TWindowHandle; inline;
Description: Get the current console default window
Console The console device to get the default window for
Return The window handle of the current default window or INVALID_HANDLE_VALUE on failure


function ConsoleWindowSetDefault(Console:PConsoleDevice; Handle:TWindowHandle):LongWord;
Description: Set the current console default window
Console The console device to set the default window for
Return ERROR_SUCCESS if completed or another error code on failure


function ConsoleWindowCheck(Console:PConsoleDevice; Window:PConsoleWindow):PConsoleWindow;
Description: Check if a console window entry is valid
Console The console device to search for the window
Window The window entry to check for validity
Return The supplied window if successful or nil on failure


function ConsoleWindowStateToString(WindowState:LongWord):String;
Description: Convert a Console Window state value to a string
Note None documented


function ConsoleWindowModeToString(WindowMode:LongWord):String;
Description: Convert a Console Window mode value to a string
Note None documented


function ConsoleWindowGetDefaultFont:TFontHandle;
Description: Get the default console window font
Note None documented


function ConsoleWindowRedirectOutput(Handle:TWindowHandle):Boolean;
Description: Redirect standard output to the console window specified by Handle
Handle The window handle to redirect output to (or INVALID_HANDLE_VALUE to stop redirection)
Return True if completed successfully or False if an error occurred
Note Redirects the output of the text files Output, ErrOutput, StdOut and StdErr which also redirects the output of Write, WriteLn and the standard C library.


Return to Unit Reference