Current area: HOME ->

Zip File view

An Icons Editor


This page allows you to view the contents of a file contained inside a ZIP archive available at Programmer's Heaven. This means you can view the code and find what you need from it without having to download the ZIP file first. If the file contains source code for a language we recognize, we have syntax highlighted it.

Filename displayed: MOUSE.PAS
Found in file: 48194.zip

Download: Softek Barcode Reader Toolkit 7.0.3 Comprehensive sdk to read barcode from images and bitmaps. Supported barcodes types include Code-39, Code-128, Code-25, Codabar, EAN-13, EAN-8, UPC-A, UPC-E, Patch and PDF-417. Download includes code...
unit Mouse;
interface

 uses Dos;

type
  MouseCursor = array[0..127] of byte;

Const
  CurOn        = True;
  CurOff       = False;
  MouseImgSize = 262;

    procedure InitMouse;

    procedure ShowMouse;
    procedure HideMouse;

    function GetMouseX:word;
    function GetMouseY:word;
    function GetMouseRelX:word;
    function GetMouseRelY:word;

    function ReturnPressedButton:word;
    function ButtonDown:boolean;
    function ButtonUp:boolean;
    function LButtonDown:boolean;
    function RButtonDown:boolean;

    procedure SetMouseSensitivity(x,y:word);
    procedure setMouseCursor(x,y : word);

    {--------------------   Yotam's procedures   ----------------------}
{    Procedure MouseDraw;
    Procedure SetGrpCursor(c : MouseCursor);
    Procedure YInitMouse;
    Procedure YShowMouse;
    Procedure YHideMouse;
    Procedure DrawBMap(C : MouseCursor; X,Y : integer);
    procedure SetMEventHandler(mask : word; handler : pointer);}


implementation

    procedure InitMouse;
    var
        Temp:word;
    begin
        asm
            mov ax,00h
            int 33h
            mov [Temp],bx
        end; {asm}
    end; {InitMouse}

    procedure ShowMouse;
    begin
        asm
            mov ax,01h
            int 33h
        end; {asm}
    end; {ShowMouse}

    procedure HideMouse;
    begin
        asm
            mov ax,02h
            int 33h
        end; {asm}
    end; {HideMouse}

    function GetMouseX:word;
    var
        Temp:word;
    begin
        asm
            mov ax,03h
            int 33h
            mov [Temp],cx
        end; {asm}
        GetMouseX:=(trunc(Temp));
    end; {GetMouseX}

    function GetMouseY:word;
    var
        Temp:word;
    begin
        asm
            mov ax,03h
            int 33h
            mov [Temp],dx
        end; {asm}
        GetMouseY:=Temp;
    end; {GetMouseY}

    function GetMouseRelX:word;
    var
        Temp:word;
    begin
        asm
            mov ax,0Bh
            int 33h
            mov [Temp],cx
        end; {asm}
        GetMouseRelX:=Temp;
    end; {GetMouseRelX}

    function GetMouseRelY:word;
    var
        Temp:word;
    begin
        asm
            mov ax,0Bh
            int 33h
            mov [Temp],dx
       end; {asm}
       GetMouseRelY:=Temp;
    end; {GetMouseRelY}

        function ReturnPressedButton:word;
        var
          Temp:word;
        begin
          asm
            mov ax,03h
            int 33h
            mov [Temp],bx
          end; {asm}
        ReturnPressedButton:=Temp;
    end; {ReturnPressedButton}

    function ButtonDown:boolean;
    begin
       ButtonDown:=ReturnPressedButton<>0;
    end; {ButtonDown}

    function RButtonDown:boolean;
    begin
       RButtonDown:=ReturnPressedButton=2;
    end; {ButtonDown}

    function LButtonDown:boolean;
    begin
       LButtonDown:=ReturnPressedButton=1;
    end; {ButtonDown}

    function ButtonUp:boolean;
    begin
       ButtonUp:=ReturnPressedButton=0;
    end; {ButtonUp}

    procedure SetMouseSensitivity(x,y:word);
    begin
        asm
            mov ax,1ah
            mov bx,[x]
            mov cx,[y]
            mov dx,1
            int 33h
        end; {asm}
    end; {SetMouseSensitivity}

    procedure setMouseCursor(x,y : word);
    var
     reg : registers;
    begin
        with reg do begin
                ax := 4;
                cx := x;
                dx := y; {prepare parameters}
                intr($33,REG);
        end; {with}
    end; {setMouseCursor}

    procedure SetMEventHandler(mask : word; handler : pointer);
    var
     Reg : Registers;
    begin
        reg.ax := 12; {set event handler function in mouse driver}
        reg.cx := mask;
        reg.es := seg(handler^);
        reg.dx := ofs(handler^);
        intr($33,Reg);
     end; {set event Handler}

   { Procedure YInitMouse;
    begin
       HideMouse;
       Ignore := False;
       MM := CurOn;
       YMO := True;
       SetMouseCursor(1,1);
       Mlx := GetMouseX;
       Mly := GetMouseY;
       Frst := True;
       GetMem(MI, MouseImgSize);
       GetMem(BI, MouseImgSize);
       GetImage(Mlx,Mly,Mlx+15,Mly+15,BI^);
       SetGrpCursor(CC);
    end;

    Procedure YShowMouse;
    begin
       if not YMO then exit;
       if MM = CurOn then exit;
       if Ignore then Exit;
       Frst := False;
       MM := CurOn;
       Mlx := GetMouseX;
       Mly := GetMouseY;
       FreeMem(BI,MouseImgSize);
       GetMem(BI,MouseImgSize);
       GetImage(mlx,mly,mlx+15,mly+15,BI^);
{       PutImage(Mlx,Mly,MI^,NormalPut);}

    {   DrawBMap(CC,Mlx,Mly);
    end;

    Procedure YHideMouse;
    begin
       if Ignore then Exit;
       if not YMO then exit;
       if MM = CurOff then exit;
       MM := CurOff;
       PutImage(Mlx,Mly,BI^,NormalPut);
       Frst := True;
    end;

    Procedure MouseDraw;
    var
     Mx, My : integer;
    begin
       if not YMO then exit;
       if MM <> CurOn then
       begin
          mlx := GetMouseX;
          mly := GetMouseY;
          Exit;
       end;
       if Ignore then Exit;
       Mx := GetMouseX;
       My := GetMouseY;
       if (Mx = Mlx) and (My = Mly) then
        Exit;
       if Mx+15 > GetMaxX then
         SetMouseCursor(GetMaxX-15,My);
       if My+15 > GetMaxY then
         SetMouseCursor(Mx,GetMaxY-15);
       Mx := GetMouseX;
       My := GetMouseY;
       if not Frst then
          PutImage(Mlx,Mly,BI^,NormalPut);

       if not Frst then
          FreeMem(BI,MouseImgSize);
       if Frst then
          Frst := False;

       GetMem(BI,MouseImgSize);
       GetImage(mx,my,mx+15,my+15,BI^);
{       PutImage(Mx,My,MI^,NormalPut);}

     {  DrawBMap(CC,Mx,My);
       Mlx := Mx;
       Mly := My;
    end;

    Procedure DrawBMap(C : MouseCursor; X,Y : integer);
    var
     i      : integer;
     sx,sy  : integer;
     b1, b2 : Byte;
    begin
       sx := 0;
       sy := 0;
       for i := 0 to 127 do
       begin
          b1 := C[i] mod 16;
          b2 := (C[i]-b1*16);
          PutPixel(X+Sx,Y+Sy,b1);
          if sx < 15 then
            inc(sx)
           else
            begin
               inc(sy);
               sx := 0;
            end;
          PutPixel(X+Sx,Y+Sy,b2);
          if sx < 15 then
            inc(sx)
           else
            begin
               inc(sy);
               sx := 0;
            end;
       end;
    end;}


   { Procedure SetGrpCursor(C : MouseCursor);
    begin
       if not YMO then exit;
       CC := C;
       PutImage(Mlx,Mly,BI^,NormalPut);
       DrawBMap(CC,Mlx,Mly);
       FreeMem(MI, MouseImgSize);
       GetMem(MI, MouseImgSize);
       GetImage(Mlx,Mly,Mlx+15,Mly+15,MI^);
       if MM <> CurOn then
         PutImage(Mlx,Mly,BI^,NormalPut);
    end;}

begin
end. {Mouse}


How to build a cheap D/A converter on the centronics port

LibMyWitch MySQL Control v1.0
LibMyWitch is a Visual Basic ActiveX Control for accessing every type of MySQL database in the internet. - even if they are remote hosted behind a firewall. The control uses a new technology. I...
Softek Barcode Reader Toolkit 7.0.3
Comprehensive sdk to read barcode from images and bitmaps. Supported barcodes types include Code-39, Code-128, Code-25, Codabar, EAN-13, EAN-8, UPC-A, UPC-E, Patch and PDF-417. Download includes code...
Download How to build a cheap D/A converter on the centronics port Download LibMyWitch MySQL Control v1.0 LibMyWitch is a Visual Basic ActiveX Control for accessing  every type of MySQL database in the internet. - even if they  are remote hosted behind a firewall. The control uses a new  technology. I... Download Softek Barcode Reader Toolkit 7.0.3 Comprehensive sdk to read barcode from images and bitmaps. Supported barcodes types include Code-39, Code-128, Code-25, Codabar, EAN-13, EAN-8, UPC-A, UPC-E, Patch and PDF-417. Download includes code...







Sponsored links

Build IT Knowledge with Current & Trusted Content
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Check Out IT Certification Preparation Materials
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
Villanova University Six Sigma & IT Certificate Programs
100% Online programs in Six Sigma, IS Security, CISSP Prep, Business Analysis, Proj. Mgmt. and more!
Localize software in three simple steps
Localize .Net, C/C++ & Delphi apps visually. HTML, HTML Help, XML & databases. Try Sisulizer now!
Delphi Localization Tool Sisulizer (WYSIWYG)
Create multilingual Delphi apps in three simple steps. Localize XML, HTML Help ... Try Sisulizer now


Newsletter | Submit Content | About | Advertising | Awards | Contact Us | Link to us |
© 1996-2008 Community Networks Ltd All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Synchron Data - .NET development.