Unit crt32

Classes

Functions

ClrEol - if not AreFileApisANSI then SetFileApisToANSI;
ClrScr -
ConsoleEnd -
Debugcrt - is Delphi runnig, im not lucky with this! (* * when you make new features to see the API-Records
Delay -
DelLine -
FlushInputBuffer -
FromPipe -
GotoXY -
HighVideo -
InsLine -
KeyPressed -
LowVideo -
NormVideo -
NoSound -
Pipe -
ReadKey -
RestoreCrt -
Sound - use less processtime as a timer
TextAttribut -
TextBackground -
TextColor -
TextMode -
WhereX -
WhereY -

Types

Constants

Black
Blue
Brown
BW40
BW80
C40
C80
CheckBreak
CheckEOF
CheckSnow
Cyan
DarkGray
DirectVideo
Gray
Green
Last
LightBlue
LightCyan
LightGray
LightGreen
LightMagenta
LightRed
Magenta
Mono
MyCP
Red
White
Yellow

Variables

HConsoleError
hConsoleInput
hConsoleOutput
LastMode
SoundDuration
SoundFrequenz
StdError
TextAttr
ViewMax
WindMax
WindMin


Functions


PROCEDURE ClrEol;

if not AreFileApisANSI then SetFileApisToANSI;

PROCEDURE ClrScr;


PROCEDURE ConsoleEnd;


PROCEDURE Debugcrt;

is Delphi runnig, im not lucky with this! (* * when you make new features to see the API-Records

PROCEDURE Delay(CONST ms : Integer);


PROCEDURE DelLine;


PROCEDURE FlushInputBuffer;


FUNCTION FromPipe : Boolean;


PROCEDURE GotoXY(CONST x, y : Integer);


PROCEDURE HighVideo;


PROCEDURE InsLine;


FUNCTION KeyPressed : Boolean;


PROCEDURE LowVideo;


PROCEDURE NormVideo;


PROCEDURE NoSound;


FUNCTION Pipe : Boolean;


FUNCTION ReadKey : Char;


PROCEDURE RestoreCrt;


PROCEDURE Sound;

use less processtime as a timer

PROCEDURE TextAttribut(CONST Color, Background : Word);


PROCEDURE TextBackground(CONST Color : Word);


PROCEDURE TextColor(CONST Color : Word);


PROCEDURE TextMode(CONST Mode : Word);


FUNCTION WhereX : Integer;


FUNCTION WhereY : Integer;


Types


Constants

Black = 0

my Country-Codepage (Germany

Blue = 1

Brown = 6

BW40 = 0

BW80 = 2

C40 = 1

C80 = 3

CheckBreak = True

CheckEOF = True

CheckSnow = False

Cyan = 3

DarkGray = 8

DirectVideo = True

Gray = DarkGray

Green = 2

Last = -1

LightBlue = 9

LightCyan = 11

LightGray = 7

LightGreen = 10

LightMagenta = 13

LightRed = 12

Magenta = 5

Mono = 7

MyCP = 1252

#freeware} {#version 1.0.0425} {#Date 01 Jun 1998} {#Author Frank Zimmer} {#description Copyright © 1998, Frank Zimmer, f.zimmer@gmx.net Date: 18. Jan 1997 an Implementation of Turbo Pascal CRT-Unit for Win32 Console Subsystem include Sourcecode and some new usefull features (known about piping output, write to STDERR without pipe). Testet with Windows NT 4.0 (my programms work also under Windows 95) At Startup you get the Focus to the Console!!!! (Functions/Procedures sign with a *, they are additional Routines) Procedure and Function: ClrEol Prozedur Löscht alle Zeichen von der momentanen Cursor-Position bis zum Zeilenende. ClrScr Prozedur Löscht den Bildschirm und setzt den Cursor in die linke obere Ecke. Delay Prozedur Wartet die angegebene Anzahl von Millisekunden. DelLine Prozedur Löscht die Zeile auf der der Cursor positioniert ist. GotoXY Prozedur Positioniert den Cursor auf gegebene Koordinaten innerhalb eines virtuellen Bildschirms. HighVideo Prozedur Setzt "hohe Intensität" für die Zeichenausgabe. InsLine Prozedur Fügt eine Leerzeile an der Position des Cursors ein. KeyPressed Funktion Prüft, ob eine Taste gedrückt wurde. LowVideo Prozedur Setzt "niedrige Intensität" für die folgenden Zeichenausgaben. NormVideo Prozedur Setzt das Textattribut für nachfolgende Ausgaben, das beim Start des Programms gesetzt war. NoSound Prozedur Schaltet den eingebauten Lautsprecher ab. ReadKey Funktion Liest ein Zeichen von der Tastatur. Sound Prozedur Aktiviert den eingebauten Lautsprecher. TextBackground Prozedur Legt die Hintergrundfarbe für folgende Textausgaben fest. TextColor Prozedur Legt die Zeichenfarbe für folgende Textausgaben fest. TextMode Prozedur Legt einen bestimmten Textmodus fest. WhereX Funktion Liefert die X-Koordinate (Zeilenposition) des Cursors zurück. WhereY Funktion Liefert die Y-Koordinate (Spaltenposition) des Cursors zurück. *TextAttribut Prozedur Set TextBackground and TextColor at the same time, usefull for Lastmode *FlushInputBuffer Prozedur Flush the Keyboard and all other Events *ConsoleEnd Prozedur output of 'Press any key' and wait for key input when not pipe *Pipe Funktion True when the output is redirected to a pipe or a file *FromPipe Funktion True when the Input is redirected over a pipe to the Console-Application *DebugCrt Procedure Show all consoleBuffer-Records Variables: WindMin the min. WindowRect WindMax the max. WindowRect TextAttr Actual Attributes only by changing with this Routines LastMode Last Attributes only by changing with this Routines *ViewMax the max. ConsoleBuffer start at (1,1); *StdError text like Input or Output but Error, you could see only the default color, Open and Close automatic *SoundFrequenz with Windows NT your could use these Variables *SoundDuration how long bells the speaker -1 until ~, default = -1 *HConsoleInput the Input-handle; *HConsoleOutput the Output-handle; *HConsoleError the Error-handle; Any comments and enhancements are welcome, if the're sended to f.zimmer@gmx.net or fzimmer@csi.com. This Source is freeware, have fun :-) Known problems and bugs: - how could i read the data who's comming from a pipe? - to know where the console-application is start (is the parent-application an console or an win32 sub-system or an ntvdm or an posix sub-system) - Window-Procedure not implemented now History: 01. Jun 98 backup and restore Input and Output-Codepage add "OEMCode" form init (SetFileApisToOEM or SetFileApisToANSI) add RestoreCrt add FromPipe get the Data from a pipe 25. Apr 98 Implementation from StdError Filehandle for Write(StdError,... 24. Jan 97 Redirected status 23. Jan 97 Sound, delay, Codepage inserted and set the focus to the console 18. Jan 97 the first implementation

Red = 4

White = 15

Yellow = 14


Variables

HConsoleError : THandle

hConsoleInput : THandle

hConsoleOutput : THandle

LastMode : Word

SoundDuration : Integer

SoundFrequenz : Integer

StdError : Text

TextAttr : Word

ViewMax : TCoord

WindMax : TCoord

WindMin : TCoord