Class TConsoleReaderThread
Unit
Declaration
type TConsoleReaderThread = class(TThread)
Description
A thread class dedicated to creating and managing a separate Windows console for input/output. The thread continuously monitors the console's standard input (stdin) and delivers received lines to the Owner using the IConsoleInputHandler interface.
Hierarchy
- TObject
- TThread
- TConsoleReaderThread
Overview
Fields
![]() |
StdInHandle: THandle; |
Methods
![]() |
procedure Execute; override; |
![]() |
procedure CSInit; |
![]() |
procedure CSBlockWrite(const ABlock: Boolean); |
![]() |
function CSIsWriteBlocked: Boolean; |
![]() |
procedure CSWrite(const S: string); |
![]() |
procedure CSWriteLn(const S: string); |
![]() |
procedure CSInput(const S: String; const pre: Boolean; const post: Boolean); overload; |
![]() |
procedure CSInput(const S: String); overload; |
![]() |
procedure CSWriteLogEntryUTC(level: TLevelLog; const MessageString: String); |
![]() |
procedure CSShow; overload; |
![]() |
procedure CSShow(MainForm: TForm); overload; |
![]() |
procedure CSShow(Mode: TConsolePosMode; MainForm: TForm; MonitorIndex: Integer = 0); overload; |
![]() |
procedure CSHide; |
![]() |
procedure CSDisableCloseButton; |
![]() |
procedure CSEnableCloseButton; |
![]() |
procedure CSSetForegroundWindow; |
![]() |
procedure MessageInfoLog(level: TLevelLog; Message: String); overload; |
![]() |
procedure MessageInfoLog(level: TLevelLog; Message: String; Info: String); overload; |
![]() |
procedure NoticeLog(Message: String); overload; |
![]() |
procedure NoticeLog(Message: String; Info: String); overload; |
![]() |
procedure WarningLog(Message: String); overload; |
![]() |
procedure WarningLog(Message: String; Info: String); overload; |
![]() |
procedure ErrorLog(Message: String); overload; |
![]() |
procedure ErrorLog(Message: String; Info: String); overload; |
![]() |
procedure InfoLog(Message: String); overload; |
![]() |
procedure InfoLog(Message: String; Info: String); overload; |
![]() |
procedure DebugLog(Message: String); overload; |
![]() |
procedure DebugLog(Message: String; Info: String); overload; |
![]() |
procedure Log(Message: String); overload; |
![]() |
procedure Log(Message: String; Info: String); overload; |
![]() |
constructor Create(AOwner: IConsoleInputHandler); overload; |
![]() |
constructor Create(AOwner: IConsoleInputHandler; Preface: String); overload; |
![]() |
constructor Create(AOwner: IConsoleInputHandler; Preface: String; AStoreText: Boolean); overload; |
![]() |
destructor Destroy; override; |
Properties
![]() |
property Owner: IConsoleInputHandler read FOwner; |
Description
Fields
![]() |
StdInHandle: THandle; |
|
The handle to the console's standard input. Used internally during initialization. | |
Methods
![]() |
procedure Execute; override; |
|
The main execution loop of the thread. Allocates the console, sets up standard I/O handles, and continuously calls | |
![]() |
procedure CSInit; |
|
Initializes the console environment. Calls | |
![]() |
procedure CSBlockWrite(const ABlock: Boolean); |
|
Sets whether console output is blocked. Parameters
| |
![]() |
function CSIsWriteBlocked: Boolean; |
|
Checks if console output is currently blocked. ReturnsTrue if console writing is blocked; otherwise, False. | |
![]() |
procedure CSWrite(const S: string); |
|
Writes the specified string to the console's standard output without a line break. Parameters
| |
![]() |
procedure CSWriteLn(const S: string); |
|
Writes the specified string to the console's standard output followed by a line break. Parameters
| |
![]() |
procedure CSWriteLogEntryUTC(level: TLevelLog; const MessageString: String); |
|
Writes a timestamped log entry to the console using UTC time. Parameters
| |
![]() |
procedure CSShow; overload; |
|
Shows the console window. Platform: Windows See also
| |
![]() |
procedure CSShow(MainForm: TForm); overload; |
|
Shows the console window. Platform: Windows Parameters
See also
| |
![]() |
procedure CSShow(Mode: TConsolePosMode; MainForm: TForm; MonitorIndex: Integer = 0); overload; |
|
Shows the console window. Platform: Windows Parameters
See also
| |
![]() |
procedure CSHide; |
|
Hides the console window. Platform: Windows See also
| |
![]() |
procedure CSDisableCloseButton; |
|
Disables the close button (X) on the console window's title bar. This prevents the user from closing the console using the standard window controls, allowing the managing application to control the console's lifecycle. Platform: Windows
See also
| |
![]() |
procedure CSEnableCloseButton; |
|
Enables the close button (X) on the console window's title bar. Platform: Windows See also
| |
![]() |
procedure CSSetForegroundWindow; |
|
Brings the console window to the foreground. Platform: Windows | |
![]() |
procedure MessageInfoLog(level: TLevelLog; Message: String); overload; |
|
Logs a message with the specified log level. Parameters
| |
![]() |
procedure MessageInfoLog(level: TLevelLog; Message: String; Info: String); overload; |
|
Logs a message with the specified log level and additional info. Parameters
| |
![]() |
procedure NoticeLog(Message: String); overload; |
|
Logs a notice-level message. Parameters
| |
![]() |
procedure WarningLog(Message: String); overload; |
|
Logs a warning-level message. Parameters
| |
![]() |
procedure ErrorLog(Message: String); overload; |
|
Logs an error-level message. Parameters
| |
![]() |
procedure InfoLog(Message: String); overload; |
|
Logs an info-level message. Parameters
| |
![]() |
procedure DebugLog(Message: String); overload; |
|
Logs a debug-level message. Parameters
| |
![]() |
procedure Log(Message: String); overload; |
|
Logs a general message. Parameters
| |
![]() |
procedure Log(Message: String; Info: String); overload; |
|
Logs a general message with additional info. Parameters
| |
![]() |
constructor Create(AOwner: IConsoleInputHandler); overload; |
|
Creates and initializes the console reader thread without a preface message. Parameters
| |
![]() |
constructor Create(AOwner: IConsoleInputHandler; Preface: String); overload; |
|
Creates and initializes the console reader thread with an initial preface message. Parameters
| |
![]() |
constructor Create(AOwner: IConsoleInputHandler; Preface: String; AStoreText: Boolean); overload; |
|
Creates and initializes the console reader thread with a preface and option to store output. Parameters
| |
![]() |
destructor Destroy; override; |
|
Destroys the thread and frees the console resource. Calls | |
Properties
![]() |
property Owner: IConsoleInputHandler read FOwner; |
|
Reference to the component implementing IConsoleInputHandler. | |

