[fpc-pascal] WinCRT vs CRT

James Richters james at productionautomation.net
Thu Sep 8 14:51:39 CEST 2016


I am working on a console application that uses the graph unit.  I want my
graphics window to be the one that accepts keyboard input,  I found out that
if I just change to 'WinCRT' instead of 'CRT' it does exactly this. however
there is a problem with WinCRT that I do not understand.  Please reference
my test program: 

 

 

Program KeyTestWin.pas;

Uses Graph,

//     CRT;

     WinCRT;

Var

   Test:Char;

   GD,GM:Integer;

Begin

   gd:=detect;

   gm:=0;

   Initgraph(gd,gm,'');

   repeat

      Test:=readkey;

      if Test<>Chr(0) then

         Writeln ('KeyCode: ',Ord(Test))

      Else

         begin

            Test := Readkey;

            Writeln ('Extended: ',Ord(Test));

         end;

   Until Test=Chr(27);

End.

 

 

If I comment out WinCRT and uncomment CRT and run it,  then I get almost the
full keyboard, for example 

ALT-X = Extended: 45

CTRL *= Extended: 150

CTRL 8 = Extended: 9

F10 = Extended: 68

CRTL F10 = Extended: 103

ALT F10 = Extended: 113

I do notice just a few keys that windows intercepts, like F11 makes it full
screen and my application never sees the keystroke, but actually very few
keys are intercepted by windows like this.

 

But with WinCRT instead of CRT, None of these and many more report anything
at all.. it's as if I didn't even hit a key.  

NONE of the keys wit ALT respond at all

CTRL works with most Letters but NO number

F10, F11, and F12 do not work.. etc. etc. etc..  you get the idea, it's
extremely limited.

 

Does anyone have any idea why this is happening or if there is another way
to get keyboard input on the graph window and be able to use the entire
keyboard?

 

Any help is greatly appreciated!

 

James

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160908/171aa000/attachment.html>


More information about the fpc-pascal mailing list