community.borland.com

Article #15727: READING CHARACTERS DIRECTLY FROM SCREEN

 Technical Notes Database

TN727D.txt   READING CHARACTERS DIRECTLY FROM SCREEN
Category   :Pascal
Platform    :All
Product    :Turbo Pascal  4.0+

Description:
Q. How can I read characters directly from the screen in Turbo
   Pascal?
A. The operation can be done though it is not implemented
   directly.  A useful function outlined below can be used to
   read characters directly from the screen.  The program using
   this function must use the DOS unit and the CRT unit.

        function GetChar(x,y: integer): char;
        var
          r: Registers;
          tx,ty: Integer;
        begin
          tx:=wherex;
          ty:=wherey;
          r.ah:=8;
          r.bh:=0;       {Current video page; 0 is default}
          GotoXy(x,y);
          intr(16,r);
          GetChar:=r.al;
          GotoXy(tx,ty);
        end;





Reference:


7/16/98 4:35:35 PM
 

Last Modified: 01-SEP-99