Program for check mouse position and button press, pascal source
Delphi & Pascal (česká wiki)
Category: Source in Pascal
Program: Mys.pas
File exe: Mys.exe
Program: Mys.pas
File exe: Mys.exe
It displays the co-ordinates of the mouse and indicates whether or not a mouse button is pressed. It helps to understand how to operate the mouse. At the end, there is a description of all standard functions of the mouse, e.g.
{ MYS.PAS Copyright (c) TrSek alias Zdeno Sekerak } { Ukazkovy program pre pracu s mysou. } { Zobrazi suradnice mysi a stlacene tlacidiel. } { } { Datum:08.06.1996 http://www.trsek.com } program pohyb_mysou; uses crt,dos; var xm,ym,but:integer; function gminit:boolean; var reg:registers; begin reg.ax:=$0000; intr($33,reg); if reg.ax=$0000 then gminit:=false else gminit:=true; but:=reg.bx; end; procedure zobraz_mys; var reg:registers; begin reg.ax:=$0001; intr($33,reg); end; procedure test_mys(var x,y,but:integer); var reg:registers; begin reg.ax:=$0003; intr($33,reg); x:=reg.cx; y:=reg.dx; but:=reg.bx; end; Begin clrscr; if not(gminit) then writeln('Nemas nainstalovany ovladac na mys.'); zobraz_mys; repeat test_mys(xm,ym,but); gotoxy(1,1); write('X=',xm:2,' Y=',ym:2); gotoxy(1,2); write('But=',but:2); until keypressed; end. { Popis: ------ 0 -inicializuje mys a zisti kolko ma tlacidiel 1 -zobrazi 2 -zrusi zobrazenie 3 -cita poziciu a stav tlacidiel 4 -nastavi poziciu 5 -vracia suradnicu stavu tlacidla 6 -vracia suradnicu kde si tlacidlo pustil 7 -vymedzi interval suradnic poohybu 8 -ako 7 ale vertikalne 9 -graficky kurzor 10 -textovy kurzor 11 -cita nastavenie kroku citaca mysy 12 -definuje uzivatelsku rutinu pre mys 13,14 -zap/vyp emulace svetelneho pera 15 -nastavenie kroku mysy }