[fpc-pascal]CRT unit (was: Beep in Windows)

Maarten Bekers elevator at wxs.nl
Sat Aug 4 01:38:36 CEST 2001

hey Jeff,

> ReadConsoleOutputAttribute, WriteConsoleOutputAttribute,
> WriteConsoleOutputCharacter, WriteConsoleOutput, ReadConsoleOutput - Uses
> these in place of the direct memory reads and writes to the screen buffer.
> GetStdHandle - Used to get the handle to the screen
> Using these I converted a BP7 windowing unit to Win32 Console, with little
> loss of speed.
If i remember correctly, the main performance penalty is actually setting
the cursor position on the screen.
The updating of the screen itself shouldn't be too slow and using
ReadConsole(), WriteConsole() has some issues.

Another way to do it would be maintaining an own array of chars/attr pairs
(like DOS's screen buffer), and writing to this, then running another thread
copying the screenbuffer to the screen upon certain events (using the
routine to write a whole buffer to the screen, can't remember its name at
the moment).
I do think this will cause some other issues though.

groeten, Maarten.

More information about the fpc-pascal mailing list