home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / MOUSE / MSMOUSE1.ZIP / PAS.ZIP / PDEMO.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1989-02-10  |  3.5 KB  |  90 lines

  1. {--------------------------------------------------------}
  2. {   PDEMO.PAS - Mouse functions and Microsoft Pascal     }
  3. {                                                        }
  4. {   Program checks that mouse driver was installed,      }
  5. {   displays a graphics cursor, and hides the cursor     }
  6. {   if it moves into the upper left part of the screen.  }
  7. {   Program ends when left mouse button is pressed.      }
  8. {                                                        }
  9. {   Make File:                                           }
  10. {                                                        }
  11. {       pdemo.obj:   pdemo.pas                           }
  12. {              pas1 pdemo;                               }
  13. {              pas2                                      }
  14. {                                                        }
  15. {       pdemo.exe:   pdemo.obj subs.obj                  }
  16. {              link pdemo subs,,,..\mouse;               }
  17. {                                                        }
  18. {--------------------------------------------------------}
  19.  
  20. program mtest(output);
  21.  
  22. procedure mousel(vars m1,m2,m3,m4:word);extern;
  23. procedure chkdrv;extern;
  24. procedure graf;extern;
  25.  
  26. var
  27.     m1,m2,m3,m4:word;
  28.     Cursor : array [0..31]of word;
  29.     bound  : array [0..3] of word;
  30.     ptradd : array [1..2] of word;
  31.     i, j : integer;
  32.  
  33. begin
  34.  
  35.     for i := 0 to 15  do cursor[i] := 16#ffff;
  36.     Cursor[16] := 16#8000;
  37.     Cursor[17] := 16#E000;
  38.     Cursor[18] := 16#F800;
  39.     Cursor[19] := 16#FE00;   {Initialize curosr array}
  40.     Cursor[20] := 16#D800;
  41.     Cursor[21] := 16#0C00;
  42.     Cursor[22] := 16#0600;
  43.     Cursor[23] := 16#0300;
  44.     for j := 24 to 31 do Cursor[j] := 16#0000;
  45.  
  46.     chkdrv;                  {Check for mouse     }
  47.                              { driver installation}
  48.     m1:=0;                   {Function call 0     }
  49.     mousel(m1,m2,m3,m4);     {initialize mouse    }
  50.     if ( m1 = 0 ) then       {No, output message  }
  51.        writeln('Microsoft mouse NOT found')
  52.     else
  53.        begin                 {Yes, demo function 9}
  54.                              { and funciton 16    }
  55.          graf;               {set to graphics mode}
  56.  
  57.          m1:=9;              {Function call 9     }
  58.          m2:=1;              { set graphics cursor}
  59.          m3:=1;
  60.          ptradd[1] := (ads Cursor).r; {offset  of the array}
  61.          ptradd[2] := (ads Cursor).s; {segment of the array}
  62.          mousel(m1,m2,m3,ptradd[1]);
  63.  
  64.          writeln('Mouse cursor will disappear within this area.');
  65.          writeln('Press the right mouse button to EXIT.........');
  66.  
  67.          m1:=1;                   {Function call 1     }
  68.          mousel(m1,m2,m3,m4);     { show mouse cursor  }
  69.  
  70.          m1 := 16;           {Function call 16    }
  71.          bound[0] := 0;      {left  x coordinate  }
  72.          bound[1] := 0;      {upper y coordinate  }
  73.          bound[2] := 390;    {right x coordinate  }
  74.          bound[3] := 25;     {lower y coordinate  }
  75.          ptradd[1] := (ads bound).r;  {offset  of the array}
  76.          ptradd[2] := (ads bound).s;  {segment of the array}
  77.          mousel(m1,m2,m3,ptradd[1]);
  78.  
  79.          m2 := 999;          {dummy value for loop}
  80.          repeat              {until...            }
  81.              m1 := 3;                   {Function call 3, get}
  82.              mousel( m1, m2, m3, m4 );  {current mouse status}
  83.          until m2 = 2;       {left button pressed }
  84.  
  85.          m1 := 0;            {reset mouse driver  }
  86.          mousel( m1, m2, m3, m4 );
  87.  
  88.        end
  89. end.
  90.