Difference between revisions of "Unit Console"

From Ultibo.org
Jump to: navigation, search
Line 2,449: Line 2,449:
 
<br />
 
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
<pre style="border: 0; padding-bottom:0px;">function ConsoleDevice?etDefault(Console:PConsoleDevice):LongWord;</pre>
+
<pre style="border: 0; padding-bottom:0px;">function ConsoleDeviceSetDefault(Console:PConsoleDevice):LongWord;</pre>
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' ?et the current default console device</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the current default console device</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 2,548: Line 2,548:
 
<br />
 
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
<pre style="border: 0; padding-bottom:0px;">function ConsoleWindow?etDefault(Console:PConsoleDevice; Handle:TWindowHandle):LongWord;</pre>
+
<pre style="border: 0; padding-bottom:0px;">function ConsoleWindowSetDefault(Console:PConsoleDevice; Handle:TWindowHandle):LongWord;</pre>
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' ?et the current console default window</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the current console default window</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"

Revision as of 04:51, 30 November 2016

Return to Unit Reference


Description


To be documented

Constants



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


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


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


Console device flag constants 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
CONSOLE_FLAG_SINGLE_CURSOR = $00000100; Console supports only one cursor (Not one per window)
CONSOLE_FLAG_BLINK_CURSOR = $00000200; Console supports blinking cursor
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_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;


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


Console window ignature constants WINDOW_SIGNATURE_*
WINDOW_SIGNATURE = $DE3A5C04;  


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


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


Console window flag constants 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


Console cursor mode constants CURSOR_MODE_*
CURSOR_MODE_INSERT = 0;  
CURSOR_MODE_OVERWRITE = 1;  


Framebuffer console specific constants FRAMEBUFFER_CONSOLE_*
FRAMEBUFFER_CONSOLE_TITLE = 'Ultibo Core (Release: ' + ULTIBO_RELEASE_NAME + ' Version: ' + ULTIBO_RELEASE_VERSION + ' Date: ' + ULTIBO_RELEASE_DATE + ')';


Type definitions


To be documented

Public variables


To be documented

Function declarations



Initialization functions

procedure ConsoleInit;
Description: To be documented
Note None documented


Console functions

function ConsoleDeviceOpen(Console:PConsoleDevice):LongWord;
Description: To be documented
Note None documented


function ConsoleDeviceClose(Console:PConsoleDevice):LongWord;
Description: To be documented
Note None documented


function ConsoleDeviceClear(Console:PConsoleDevice; Color:LongWord):LongWord;
Description: To be documented
Note Color must be specified in the default color format (See COLOR_FORMAT_DEFAULT)


function ConsoleDeviceClose(Console:PConsoleDevice):LongWord;
Description: To be documented
Note None documented


function ConsoleDeviceScroll(Console:PConsoleDevice; X1,Y1,X2,Y2,Count,Direction:LongWord):LongWord;
Description: To be documented
Note None documented


function ConsoleDeviceDrawBox(Console:PConsoleDevice; X1,Y1,X2,Y2,Color,Width:LongWord):LongWord;
Description: To be documented
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: To be documented
Note Color must be specified in the default color format (See COLOR_FORMAT_DEFAULT)


function ConsoleDeviceDrawChar(Console:PConsoleDevice; Handle:TFontHandle; Ch:Char; X,Y,Forecolor,Backcolor:LongWord):LongWord;
Description: To be documented
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: To be documented
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: To be documented
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: To be documented
Note Color must be specified in the default color format (See COLOR_FORMAT_DEFAULT)


function ConsoleDeviceDrawImage(Console:PConsoleDevice; X,Y:LongWord; Buffer:Pointer; Width,Height,Format,Skip:LongWord):LongWord;
Description: To be documented
Skip The number of pixels to skip in the buffer after each row (Optional)


function ConsoleDeviceDrawWindow(Console:PConsoleDevice; Handle:TWindowHandle):LongWord;
Description: To be documented
Note None documented


function ConsoleDeviceGetPixel(Console:PConsoleDevice; X,Y:LongWord; var Color:LongWord):LongWord;
Description: To be documented
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: To be documented
Skip The number of pixels to skip in the buffer after each row (Optional)


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: To be documented
Note None documented


function ConsoleDeviceGetPosition(Console:PConsoleDevice; Position:LongWord; var X1,Y1,X2,Y2:LongWord):LongWord;
Description: To be documented
Note None documented


function ConsoleDeviceGetProperties(Console:PConsoleDevice; Properties:PConsoleProperties):LongWord;
Description: To be documented
Note None documented


function ConsoleDeviceCheckFlag(Console:PConsoleDevice; Flag:LongWord):Boolean;
Description: To be documented
Note None documented


function ConsoleDeviceGetMode(Console:PConsoleDevice):LongWord;
Description: To be documented
Note None documented


function ConsoleDeviceGetState(Console:PConsoleDevice):LongWord;
Description: To be documented
Note None documented


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
Note None documented


function ConsoleDeviceRegister(Console:PConsoleDevice):LongWord;
Description: Register a new Console in the Console table
Note None documented


function ConsoleDeviceDeregister(Console:PConsoleDevice):LongWord;
Description: Deregister a Console from the Console table
Note None documented


function ConsoleDeviceFind(ConsoleId:LongWord):PConsoleDevice;
Description: To be documented
Note None documented


function ConsoleDeviceFindByDevice(Device:PDevice):PConsoleDevice;
Description: To be documented
Note None documented


function ConsoleDeviceFindByName(const Name:String):PConsoleDevice; inline;
Description: To be documented
Note None documented


function ConsoleDeviceFindByDescription(const Description:String):PConsoleDevice; inline;
Description: To be documented
Note None documented


function ConsoleDeviceEnumerate(Callback:TConsoleEnumerate; Data:Pointer):LongWord;
Description: To be documented
Note None documented


function ConsoleDeviceNotification(Console:PConsoleDevice; Callback:TConsoleNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Description: To be documented
Note None documented


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)
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)
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 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 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;

function ConsoleWindowCreate(Console:PConsoleDevice; Position:LongWord; Default:Boolean):TWindowHandle;
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: To be documented
Note None documented


function ConsoleWindowSetCursorXY(Handle:TWindowHandle; X,Y:LongWord):LongWord;
Description: To be documented
Note None documented


function ConsoleWindowGetCursorBlink(Handle:TWindowHandle):Boolean;
Description: To be documented
Note None documented


function ConsoleWindowSetCursorBlink(Handle:TWindowHandle; CursorBlink:Boolean):LongWord;
Description: To be documented
Note None documented


function ConsoleWindowGetCursorState(Handle:TWindowHandle):TCursorState;
Description: To be documented
Note None documented


function ConsoleWindowSetCursorState(Handle:TWindowHandle; CursorState:TCursorState):LongWord;
Description: To be documented
Note None documented


function ConsoleWindowCursorOn(Handle:TWindowHandle):LongWord;
Description: To be documented
Note None documented


function ConsoleWindowCursorOff(Handle:TWindowHandle):LongWord;
Description: To be documented
Note None documented


function ConsoleWindowCursorMove(Handle:TWindowHandle; X,Y:LongWord):LongWord;
Description: To be documented
Note None documented


function ConsoleWindowCursorBlink(Handle:TWindowHandle; Enabled:Boolean):LongWord;
Description: To be documented
Note None documented


function ConsoleWindowScrollUp(Handle:TWindowHandle; Row,Lines:LongWord):LongWord;
Description: To be documented
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: To be documented
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: To be documented
Row Row is the starting row (Y) for the scroll left, all rows from Row down to Row + Lines will be scrolled left
Lines Lines is the number of rows to scroll left, all rows from Row down to Row + Lines will be scrolled left
Col Col is the starting column (X) for the scroll left, all cols from left plus Chars to Col with be scrolled left
Char Chars is the number of characters to scroll left, Chars number of columnss at the left will be discarded
Note The starting Col will be blanked with the background color


function ConsoleWindowScrollRight(Handle:TWindowHandle; Row,Col,Lines,Chars:LongWord):LongWord;
Description: To be documented
Row Row is the starting row (Y) for the scroll right, all rows from Row down to Row + Lines will be scrolled right
Lines Lines is the number of rows to scroll right, all rows from Row down to Row + Lines will be scrolled right
Col Col is the starting column (X) for the scroll right, all rows from right minus Chars to Col will be scrolled right
Char Chars is the number of characters to scroll right, Chars number of columns at the right will be discarded
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: To be documented
Note None documented


function ConsoleWindowWriteEx(Handle:TWindowHandle; const AText:String; X,Y:LongWord; Forecolor,Backcolor:LongWord):LongWord;
Description: To be documented
Note For Text Console functions, X and Y are based on screen character rows and columns not screen pixels


function ConsoleWindowWriteLn(Handle:TWindowHandle; const AText:String):LongWord;
Description: To be documented
Note None documented


function ConsoleWindowWriteLnEx(Handle:TWindowHandle; const AText:String; X,Y:LongWord; Forecolor,Backcolor:LongWord):LongWord;
Description: To be documented
Note For Text Console functions, X and Y are based on character rows and columns not screen pixels


function ConsoleWindowWriteChr(Handle:TWindowHandle; AChr:Char):LongWord;
Description: To be documented
Note None documented


function ConsoleWindowWriteChrEx(Handle:TWindowHandle; AChr:Char; X,Y:LongWord; Forecolor,Backcolor:LongWord):LongWord;
Description: To be documented
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.


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: To be documented
Note For CRT Console functions, Row and Lines are based on character rows and columns not screen pixels


procedure ConsoleScrollDown(Row,Lines:Integer);
Description: To be documented
Note For CRT Console functions, Row and Lines are based on character rows and columns not screen pixels


procedure ConsoleWrite(const AText:String);
Description: To be documented
Note None documented


procedure ConsoleWriteLn(const AText:String);
Description: To be documented
Note None documented


procedure ConsoleWriteChr(AChr:Char);
Description: To be documented
Note None documented


procedure ConsoleRead(var AText:String);
Description: Read text from console input and echo to screen
Note None documented


procedure ConsoleReadLn(var AText:String);
Description: Read text from console input and echo to screen
Note None documented


procedure ConsoleReadChr(var AChr:Char);
Description: Read characters from console input and echo to screen
Note None documented


RTL console functions

function SysConsoleWriteChar(ACh:Char; AUserData:Pointer):Boolean;
Description: To be documented
Note None documented


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):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


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; inline;
Description: Get the current console device count
Note None documented


function ConsoleDeviceGetDefault:PConsoleDevice; inline;
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 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
Note None documented


function ConsoleWindowGetDefault(Console:PConsoleDevice):TWindowHandle; inline;
Description: Get the current console default window
Note None documented


function ConsoleWindowSetDefault(Console:PConsoleDevice; Handle:TWindowHandle):LongWord;
Description: Set the current console default window
Note None documented


function ConsoleWindowCheck(Console:PConsoleDevice; Window:PConsoleWindow):PConsoleWindow;
Description: To be documented
Note None documented


Return to Unit Reference