[fpc-pascal]CRT unit (was: Beep in Windows)
daworm9 at home.com
Sat Aug 4 09:02:40 CEST 2001
On 8/4/2001 at 1:38 AM Maarten Bekers wrote:
>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.
I never had a problem with updating the cursor position, but then again, with the windowing unit I wrote, the cursor was off most of the time. It was only on when a user was expected to enter data, which wasn't often. As far as positioning text on the screen, it worked very well. Like I said, this was a text based windowing system that would read the screen contents and save them when a window opened, and restore them when a window closed. However, it didn't have any niceties like allowing the user to move/resize the window, so it may have suffered in that respect. Fortunately, this app didn't need any of that level of complexity.
I moved away from CRT level programming early, and writing directly to the video memory was par for the course in my BP days. Doing the same in Win32 didn't turn out to be hard, as long as certain assumptions could be made. The "larger than physical screen" of Windows NT didn't bother me, because my apps were always pure console and I didn't care if the user made the console 80x50 (or 255x255) when the app was written for 80x25. So what if it didn't fill the screen, as long as it was consistent within the screen size it was designed for. The installation process built a shortcut that forced the screen resolution to what I wanted it to be (full screen 80x25), and if the user decided to change it, then that was their problem. After seeing it didn't do any good to make the screen bigger, they would quickly change it back. Sometimes you have to make these kinds of trade offs.
Anyway, the apps I wrote were designed to be the sole app running on the computer. I took advantage of the helpful bits of Windows like networking and such, but forcing screen size wasn't a problem. I had the luxury of not having to worry about it, but many of the techniques involved in what I did could be used for the generic case. If I get a chance, I may look at the Win32 version of CRT and see what can be done, but I doubt it will happen soon.
More information about the fpc-pascal