Jump to content
Wolfgang03

Console application - CRT Unit - Console Library

Recommended Posts

I have created library for Delphi-Console-Applications

  • Supports Windows 11 (and earlier from XE5?)
  • Replaces CRT Unit - crt.pas
  • Can be used to write modern and appealing console applications.
  • Should allow older (legacy) source code (Borland Pascal 7.0) to run under Windows.
  • Unicode-Support (including e.g. chinese characters)
  • many more features - see GitHub

 

https://github.com/playcom-de/Console

 

I hope this is helpful for someone. Question, suggestions and error reports are welcome.

  • Like 4
  • Thanks 2

Share this post


Link to post

nice,  for some apps/usecases console beats windows apps.

somewhere i have some progressbar code for console also.

 

back at the time i also had a "Painter" application, with which you can design "Screens", export them to ASCI/ANSI, TurboPascal CRT, etc. 

 

 

i get a range check error, on the minimalconsole app demo?

 


Function  tConsole.GetKeyboardLayout : TKeyboardLayout;
Var
  pwszKLID : Array [0..KL_NameLength] of Char;
begin
  FillChar(pwszKLID,sizeof(pwszKLID),#0);
  if (GetKeyboardLayoutNameW(pwszKLID)) then
  begin
    FKeyboardLayout := StrToInt('$'+StrPas(pwszKLID));
  end else
  begin
    FKeyboardLayout := _KeyboardLayout_de_DE;
  end;
  Result := FKeyboardLayout;
end;

On  the strtoint('$'+ .... line

(pwszKLID = ('0', '0', '0', '2', '0', '4', '0', '9', #0 #0)

 

Edited by mvanrijnen

Share this post


Link to post
1 hour ago, Lars Fosdal said:

Wow, that sent me back to the 80's 🙂

Nicely done!

Thanks!

Share this post


Link to post
10 minutes ago, mvanrijnen said:

nice,  for some apps/usecases console beats windows apps.

somewhere i have some progressbar code for console also. 

 

back at the time i also had a "Painter" application, with which you can design "Screens", export them to ASCI/ANSI, TurboPascal CRT, etc. 

 

If you find the progressbar source code, I'll gladly take it and integrate it into the library.

Share this post


Link to post

Back in those days, I wrote a GUI for my first commercial DOS app. It supported Hercules, EGA, and VGA cards at the time. 

 

 

Source code on GitHub - UPPERCASE reserved words and all...

Edited by Lars Fosdal
Added link to source code
  • Like 1

Share this post


Link to post
1 minute ago, Lars Fosdal said:

Back in those days, I wrote a GUI for my first commercial DOS app. It supported Hercules and EGA cards at the time. 

 

 

 

yes, my library back then, poked  right into the videomemory. 

clocking the windowing functions with a analog stopwatch from my father, checking if i could find somewhere to speed the things up. 
 

(my father thought i was somekind of idiot, clocking the timing of putting thousands of random rectangles on the screen 🙂, but then he also was scared when i took his 8000$ company laptop apart 🙂 )

  • Haha 1

Share this post


Link to post
23 minutes ago, mvanrijnen said:

See: Keyboard identifiers and input method editors for Windows | Microsoft Learn

 

United States-International 00020409

 

In Ply.Types.pas

 

change TKeyboardLayout from Word to Longword, now is the wrong type.


 TKeyboardLayout         = LongWord; // Word;
 

Yes, you are right, TKeyboardLayout must be a LongWord. Thanks, will be fixed with the next update.

Share this post


Link to post
36 minutes ago, mvanrijnen said:

When i start the move_window demo,  i get this effect:
(same with other demo's as wel)

 

 

The demos must be started as Windows-Consolehost not Windows-Terminal.

You are able to change this at windows-settings "privacy and security for developers".

This is a known issue I am working on.

I welcome any help on how to accomplish this.

  • Thanks 1

Share this post


Link to post
1 hour ago, mvanrijnen said:

 

yes, my library back then, poked  right into the videomemory. 

clocking the windowing functions with a analog stopwatch from my father, checking if i could find somewhere to speed the things up. 
 

(my father thought i was somekind of idiot, clocking the timing of putting thousands of random rectangles on the screen 🙂, but then he also was scared when i took his 8000$ company laptop apart 🙂 )

@Lars Fosdal

Great stuff!

 

@mvanrijnen

I have done similar test to find out how fast which way of manipulating the console buffer is fastest. 😉

For example, if speed is an issue, you should use WriteString instead of Writeln.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×