Wolfgang03 8 Posted July 5, 2023 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. 4 2 Share this post Link to post
Lars Fosdal 1792 Posted July 5, 2023 Wow, that sent me back to the 80's 🙂 Nicely done! Share this post Link to post
mvanrijnen 123 Posted July 5, 2023 (edited) 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 July 5, 2023 by mvanrijnen Share this post Link to post
Wolfgang03 8 Posted July 5, 2023 1 hour ago, Lars Fosdal said: Wow, that sent me back to the 80's 🙂 Nicely done! Thanks! Share this post Link to post
Wolfgang03 8 Posted July 5, 2023 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
Lars Fosdal 1792 Posted July 5, 2023 (edited) 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 July 5, 2023 by Lars Fosdal Added link to source code 1 Share this post Link to post
mvanrijnen 123 Posted July 5, 2023 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 🙂 ) 1 Share this post Link to post
mvanrijnen 123 Posted July 5, 2023 When i start the move_window demo, i get this effect: (same with other demo's as wel) Share this post Link to post
mvanrijnen 123 Posted July 5, 2023 (edited) 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; Edited July 5, 2023 by mvanrijnen Share this post Link to post
Wolfgang03 8 Posted July 5, 2023 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
Wolfgang03 8 Posted July 5, 2023 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. 1 Share this post Link to post
Wolfgang03 8 Posted July 5, 2023 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