Using the Mouse in Pascal

1. How do I use the mouse in pascal? Im trying to have a program react to the left and right mouse click...

2. Furthermore I am trying to store the information I collect in the way in a txt file. Ive programmed pascal to store keys the program user enters in a .dat file but i expect that this process will have no way of storing which mouse button is clicked just like it cannot store the left or right key stroke but uses an empty space to do this... Is there any way around this?

Comments

  • : 1. How do I use the mouse in pascal? Im trying to have a program react to the left and right mouse click...
    :
    : 2. Furthermore I am trying to store the information I collect in the way in a txt file. Ive programmed pascal to store keys the program user enters in a .dat file but i expect that this process will have no way of storing which mouse button is clicked just like it cannot store the left or right key stroke but uses an empty space to do this... Is there any way around this?
    :
    In TP6+, you can use the Mouse unit. This unit defines the TMouse object, which can be used to gain access to the mouse routines. The mouse unit also defines several constants which are returned in response to the various button clicks. You can store those constants in a text file.
  • : : 1. How do I use the mouse in pascal? Im trying to have a program react to the left and right mouse click...
    : :
    : : 2. Furthermore I am trying to store the information I collect in the way in a txt file. Ive programmed pascal to store keys the program user enters in a .dat file but i expect that this process will have no way of storing which mouse button is clicked just like it cannot store the left or right key stroke but uses an empty space to do this... Is there any way around this?
    : :
    : In TP6+, you can use the Mouse unit. This unit defines the TMouse object, which can be used to gain access to the mouse routines. The mouse unit also defines several constants which are returned in response to the various button clicks. You can store those constants in a text file.
    :

    I have TP7 and I just looked up "mouse" in the index, but for some strange reason my index is now in french??? even though all the other menus in tp are english. Is there any way for me to fix this?

    Is ther eanother place I can learn more about how to use the mouse in tp beside this forum and the index?
  • : : : 1. How do I use the mouse in pascal? Im trying to have a program react to the left and right mouse click...
    : : :
    : : : 2. Furthermore I am trying to store the information I collect in the way in a txt file. Ive programmed pascal to store keys the program user enters in a .dat file but i expect that this process will have no way of storing which mouse button is clicked just like it cannot store the left or right key stroke but uses an empty space to do this... Is there any way around this?
    : : :
    : : In TP6+, you can use the Mouse unit. This unit defines the TMouse object, which can be used to gain access to the mouse routines. The mouse unit also defines several constants which are returned in response to the various button clicks. You can store those constants in a text file.
    : :
    :
    : I have TP7 and I just looked up "mouse" in the index, but for some strange reason my index is now in french??? even though all the other menus in tp are english. Is there any way for me to fix this?
    :
    : Is ther eanother place I can learn more about how to use the mouse in tp beside this forum and the index?
    :
    Hi !

    The only version of Turbo Pascal 7 released by Borland to public domain is the French one. In a legal way you can find the TP 5.5 English help files.
  • [b][red]This message was edited by Phat Nat at 2006-12-12 17:31:50[/red][/b][hr]
    : 1. How do I use the mouse in pascal? Im trying to have a program react to the left and right mouse click...
    :
    : 2. Furthermore I am trying to store the information I collect in the way in a txt file. Ive programmed pascal to store keys the program user enters in a .dat file but i expect that this process will have no way of storing which mouse button is clicked just like it cannot store the left or right key stroke but uses an empty space to do this... Is there any way around this?
    :

    For storing the Left & Right keystrokes you need to read READKEY twice. The first time will return a "0" (meaning extended function) and the second key will be the real keystroke value (75=Left 77=Right)
    If these values are found, you could store them as characters 27 & 26 ( & ) for easier deciphering.

    As for the Mouse, if you're using TP7 this will work (as it supports inline assembly). It's not in a unit, but it will get the job done. It will give you the X, Y & Buttons of the mouse.
    Mouse Buttons: Lf=1, Rt=2, Lf&Rt=3, Cn=4, Lf&Cn=5, etc

    [code]
    PROCEDURE GetMouse(VAR MouseX, MouseY : Word; VAR MouseB : Byte); Assembler;
    ASM
    Mov Ax, $0003 { Function 3 = Get Mouse X,Y & Buttons }
    Int $33 { Int $33 = Mouse Functions }
    Shr Cx, 1 { Divide MouseX by 2 }
    Les Di, MouseX { ES:DI = @MouseX }
    Mov Es:[Di], Cx { MouseX is returned as 0-639, I want 0-319 }
    Les Di, MouseY { ES:DI = @MouseY }
    Mov Es:[Di], Dx { MouseY is returned as 0-199 }
    Les Di, MouseB { ES:DI = @MouseB }
    Mov Es:[Di], Bl { Mouse Buttons }
    End;
    [/code]

    Hope this is what you need.
    Phat Nat

    PS - Thought you may want these too:
    [code]
    PROCEDURE ShowMouse; Assembler;
    ASM
    Mov Ax, $0001 { Function 1 = Show Mouse Cursor }
    Int $33 { Int $33 = Mouse Functions }
    End;

    PROCEDURE HideMouse; Assembler;
    ASM
    Mov Ax, $0000 { Function 0 = Hide Mouse Cursor }
    Int $33 { Int $33 = Mouse Functions }
    End;
    [/code]





  • : [b][red]This message was edited by Phat Nat at 2006-12-12 17:31:50[/red][/b][hr]
    : : 1. How do I use the mouse in pascal? Im trying to have a program react to the left and right mouse click...
    : :
    : : 2. Furthermore I am trying to store the information I collect in the way in a txt file. Ive programmed pascal to store keys the program user enters in a .dat file but i expect that this process will have no way of storing which mouse button is clicked just like it cannot store the left or right key stroke but uses an empty space to do this... Is there any way around this?
    : :
    :
    : For storing the Left & Right keystrokes you need to read READKEY twice. The first time will return a "0" (meaning extended function) and the second key will be the real keystroke value (75=Left 77=Right)
    : If these values are found, you could store them as characters 27 & 26 ( & ) for easier deciphering.
    :
    : As for the Mouse, if you're using TP7 this will work (as it supports inline assembly). It's not in a unit, but it will get the job done. It will give you the X, Y & Buttons of the mouse.
    : Mouse Buttons: Lf=1, Rt=2, Lf&Rt=3, Cn=4, Lf&Cn=5, etc
    :
    : [code]
    : PROCEDURE GetMouse(VAR MouseX, MouseY : Word; VAR MouseB : Byte); Assembler;
    : ASM
    : Mov Ax, $0003 { Function 3 = Get Mouse X,Y & Buttons }
    : Int $33 { Int $33 = Mouse Functions }
    : Shr Cx, 1 { Divide MouseX by 2 }
    : Les Di, MouseX { ES:DI = @MouseX }
    : Mov Es:[Di], Cx { MouseX is returned as 0-639, I want 0-319 }
    : Les Di, MouseY { ES:DI = @MouseY }
    : Mov Es:[Di], Dx { MouseY is returned as 0-199 }
    : Les Di, MouseB { ES:DI = @MouseB }
    : Mov Es:[Di], Bl { Mouse Buttons }
    : End;
    : [/code]
    :
    : Hope this is what you need.
    : Phat Nat
    :
    : PS - Thought you may want these too:
    : [code]
    : PROCEDURE ShowMouse; Assembler;
    : ASM
    : Mov Ax, $0001 { Function 1 = Show Mouse Cursor }
    : Int $33 { Int $33 = Mouse Functions }
    : End;
    :
    : PROCEDURE HideMouse; Assembler;
    : ASM
    : Mov Ax, $0000 { Function 0 = Hide Mouse Cursor }
    : Int $33 { Int $33 = Mouse Functions }
    : End;
    : [/code]
    :
    :
    :
    :
    :
    :


    Hi PhatNat,
    thanks for your reply, as always. One question, Im trying to use this procedure in a pascal program:

    PROGRAM Mouze;
    USES Crt;


    PROCEDURE GetMouse(VAR MouseX, MouseY : Word; VAR MouseB : Byte); Assembler;
    ASM
    Mov Ax, $0003 { Function 3 = Get Mouse X,Y & Buttons }
    Int $33 { Int $33 = Mouse Functions }
    Shr Cx, 1 { Divide MouseX by 2 }
    Les Di, MouseX { ES:DI = @MouseX }
    Mov Es:[Di], Cx { MouseX is returned as 0-639, I want 0-319 }
    Les Di, MouseY { ES:DI = @MouseY }
    Mov Es:[Di], Dx { MouseY is returned as 0-199 }
    Les Di, MouseB { ES:DI = @MouseB }
    Mov Es:[Di], Bl { Mouse Buttons }
    End;

    BEGIN
    GetMouse;
    END.

    When I try to compile this i get "Error 88:"(" Expected. Fro the bit of research i did i gather that not every procedure needs to be followed by a bracket... What should I put in the brackets?

    thx!
    NA
  • : : [b][red]This message was edited by Phat Nat at 2006-12-12 17:31:50[/red][/b][hr]
    : : : 1. How do I use the mouse in pascal? Im trying to have a program react to the left and right mouse click...
    : : :
    : : : 2. Furthermore I am trying to store the information I collect in the way in a txt file. Ive programmed pascal to store keys the program user enters in a .dat file but i expect that this process will have no way of storing which mouse button is clicked just like it cannot store the left or right key stroke but uses an empty space to do this... Is there any way around this?
    : : :
    : :
    : : For storing the Left & Right keystrokes you need to read READKEY twice. The first time will return a "0" (meaning extended function) and the second key will be the real keystroke value (75=Left 77=Right)
    : : If these values are found, you could store them as characters 27 & 26 ( & ) for easier deciphering.
    : :
    : : As for the Mouse, if you're using TP7 this will work (as it supports inline assembly). It's not in a unit, but it will get the job done. It will give you the X, Y & Buttons of the mouse.
    : : Mouse Buttons: Lf=1, Rt=2, Lf&Rt=3, Cn=4, Lf&Cn=5, etc
    : :
    : : [code]
    : : PROCEDURE GetMouse(VAR MouseX, MouseY : Word; VAR MouseB : Byte); Assembler;
    : : ASM
    : : Mov Ax, $0003 { Function 3 = Get Mouse X,Y & Buttons }
    : : Int $33 { Int $33 = Mouse Functions }
    : : Shr Cx, 1 { Divide MouseX by 2 }
    : : Les Di, MouseX { ES:DI = @MouseX }
    : : Mov Es:[Di], Cx { MouseX is returned as 0-639, I want 0-319 }
    : : Les Di, MouseY { ES:DI = @MouseY }
    : : Mov Es:[Di], Dx { MouseY is returned as 0-199 }
    : : Les Di, MouseB { ES:DI = @MouseB }
    : : Mov Es:[Di], Bl { Mouse Buttons }
    : : End;
    : : [/code]
    : :
    : : Hope this is what you need.
    : : Phat Nat
    : :
    : : PS - Thought you may want these too:
    : : [code]
    : : PROCEDURE ShowMouse; Assembler;
    : : ASM
    : : Mov Ax, $0001 { Function 1 = Show Mouse Cursor }
    : : Int $33 { Int $33 = Mouse Functions }
    : : End;
    : :
    : : PROCEDURE HideMouse; Assembler;
    : : ASM
    : : Mov Ax, $0000 { Function 0 = Hide Mouse Cursor }
    : : Int $33 { Int $33 = Mouse Functions }
    : : End;
    : : [/code]
    : :
    : :
    : :
    : :
    : :
    : :
    :
    :
    : Hi PhatNat,
    : thanks for your reply, as always. One question, Im trying to use this procedure in a pascal program:
    :
    : PROGRAM Mouze;
    : USES Crt;
    :
    :
    : PROCEDURE GetMouse(VAR MouseX, MouseY : Word; VAR MouseB : Byte); Assembler;
    : ASM
    : Mov Ax, $0003 { Function 3 = Get Mouse X,Y & Buttons }
    : Int $33 { Int $33 = Mouse Functions }
    : Shr Cx, 1 { Divide MouseX by 2 }
    : Les Di, MouseX { ES:DI = @MouseX }
    : Mov Es:[Di], Cx { MouseX is returned as 0-639, I want 0-319 }
    : Les Di, MouseY { ES:DI = @MouseY }
    : Mov Es:[Di], Dx { MouseY is returned as 0-199 }
    : Les Di, MouseB { ES:DI = @MouseB }
    : Mov Es:[Di], Bl { Mouse Buttons }
    : End;
    :
    : BEGIN
    : GetMouse;
    : END.
    :
    : When I try to compile this i get "Error 88:"(" Expected. Fro the bit of research i did i gather that not every procedure needs to be followed by a bracket... What should I put in the brackets?
    :
    : thx!
    : NA
    :
    The variables to receive the location of the mouse cursor and buttons, i.e.:
    [code]
    VAR MouseX, MouseY : Word; VAR MouseB : Byte
    [/code]
    as seen in the declaration of the procedure.

  • : : : [b][red]This message was edited by Phat Nat at 2006-12-12 17:31:50[/red][/b][hr]
    : : : : 1. How do I use the mouse in pascal? Im trying to have a program react to the left and right mouse click...
    : : : :
    : : : : 2. Furthermore I am trying to store the information I collect in the way in a txt file. Ive programmed pascal to store keys the program user enters in a .dat file but i expect that this process will have no way of storing which mouse button is clicked just like it cannot store the left or right key stroke but uses an empty space to do this... Is there any way around this?
    : : : :
    : : :
    : : : For storing the Left & Right keystrokes you need to read READKEY twice. The first time will return a "0" (meaning extended function) and the second key will be the real keystroke value (75=Left 77=Right)
    : : : If these values are found, you could store them as characters 27 & 26 ( & ) for easier deciphering.
    : : :
    : : : As for the Mouse, if you're using TP7 this will work (as it supports inline assembly). It's not in a unit, but it will get the job done. It will give you the X, Y & Buttons of the mouse.
    : : : Mouse Buttons: Lf=1, Rt=2, Lf&Rt=3, Cn=4, Lf&Cn=5, etc
    : : :
    : : : [code]
    : : : PROCEDURE GetMouse(VAR MouseX, MouseY : Word; VAR MouseB : Byte); Assembler;
    : : : ASM
    : : : Mov Ax, $0003 { Function 3 = Get Mouse X,Y & Buttons }
    : : : Int $33 { Int $33 = Mouse Functions }
    : : : Shr Cx, 1 { Divide MouseX by 2 }
    : : : Les Di, MouseX { ES:DI = @MouseX }
    : : : Mov Es:[Di], Cx { MouseX is returned as 0-639, I want 0-319 }
    : : : Les Di, MouseY { ES:DI = @MouseY }
    : : : Mov Es:[Di], Dx { MouseY is returned as 0-199 }
    : : : Les Di, MouseB { ES:DI = @MouseB }
    : : : Mov Es:[Di], Bl { Mouse Buttons }
    : : : End;
    : : : [/code]
    : : :
    : : : Hope this is what you need.
    : : : Phat Nat
    : : :
    : : : PS - Thought you may want these too:
    : : : [code]
    : : : PROCEDURE ShowMouse; Assembler;
    : : : ASM
    : : : Mov Ax, $0001 { Function 1 = Show Mouse Cursor }
    : : : Int $33 { Int $33 = Mouse Functions }
    : : : End;
    : : :
    : : : PROCEDURE HideMouse; Assembler;
    : : : ASM
    : : : Mov Ax, $0000 { Function 0 = Hide Mouse Cursor }
    : : : Int $33 { Int $33 = Mouse Functions }
    : : : End;
    : : : [/code]
    : : :
    : : :
    : : :
    : : :
    : : :
    : : :
    : :
    : :
    : : Hi PhatNat,
    : : thanks for your reply, as always. One question, Im trying to use this procedure in a pascal program:
    : :
    : : PROGRAM Mouze;
    : : USES Crt;
    : :
    : :
    : : PROCEDURE GetMouse(VAR MouseX, MouseY : Word; VAR MouseB : Byte); Assembler;
    : : ASM
    : : Mov Ax, $0003 { Function 3 = Get Mouse X,Y & Buttons }
    : : Int $33 { Int $33 = Mouse Functions }
    : : Shr Cx, 1 { Divide MouseX by 2 }
    : : Les Di, MouseX { ES:DI = @MouseX }
    : : Mov Es:[Di], Cx { MouseX is returned as 0-639, I want 0-319 }
    : : Les Di, MouseY { ES:DI = @MouseY }
    : : Mov Es:[Di], Dx { MouseY is returned as 0-199 }
    : : Les Di, MouseB { ES:DI = @MouseB }
    : : Mov Es:[Di], Bl { Mouse Buttons }
    : : End;
    : :
    : : BEGIN
    : : GetMouse;
    : : END.
    : :
    : : When I try to compile this i get "Error 88:"(" Expected. Fro the bit of research i did i gather that not every procedure needs to be followed by a bracket... What should I put in the brackets?
    : :
    : : thx!
    : : NA
    : :
    : The variables to receive the location of the mouse cursor and buttons, i.e.:
    : [code]
    : VAR MouseX, MouseY : Word; VAR MouseB : Byte
    : [/code]
    : as seen in the declaration of the procedure.
    :
    :


    But I still have no way of knowing what MouseX and MouseY etc are? Simply entering these variables does not get me anywhere. What should I do to avoid this error "Error 88"?

    thx so much!
    NA
  • : : : : [b][red]This message was edited by Phat Nat at 2006-12-12 17:31:50[/red][/b][hr]
    : : : : : 1. How do I use the mouse in pascal? Im trying to have a program react to the left and right mouse click...
    : : : : :
    : : : : : 2. Furthermore I am trying to store the information I collect in the way in a txt file. Ive programmed pascal to store keys the program user enters in a .dat file but i expect that this process will have no way of storing which mouse button is clicked just like it cannot store the left or right key stroke but uses an empty space to do this... Is there any way around this?
    : : : : :
    : : : :
    : : : : For storing the Left & Right keystrokes you need to read READKEY twice. The first time will return a "0" (meaning extended function) and the second key will be the real keystroke value (75=Left 77=Right)
    : : : : If these values are found, you could store them as characters 27 & 26 ( & ) for easier deciphering.
    : : : :
    : : : : As for the Mouse, if you're using TP7 this will work (as it supports inline assembly). It's not in a unit, but it will get the job done. It will give you the X, Y & Buttons of the mouse.
    : : : : Mouse Buttons: Lf=1, Rt=2, Lf&Rt=3, Cn=4, Lf&Cn=5, etc
    : : : :
    : : : : [code]
    : : : : PROCEDURE GetMouse(VAR MouseX, MouseY : Word; VAR MouseB : Byte); Assembler;
    : : : : ASM
    : : : : Mov Ax, $0003 { Function 3 = Get Mouse X,Y & Buttons }
    : : : : Int $33 { Int $33 = Mouse Functions }
    : : : : Shr Cx, 1 { Divide MouseX by 2 }
    : : : : Les Di, MouseX { ES:DI = @MouseX }
    : : : : Mov Es:[Di], Cx { MouseX is returned as 0-639, I want 0-319 }
    : : : : Les Di, MouseY { ES:DI = @MouseY }
    : : : : Mov Es:[Di], Dx { MouseY is returned as 0-199 }
    : : : : Les Di, MouseB { ES:DI = @MouseB }
    : : : : Mov Es:[Di], Bl { Mouse Buttons }
    : : : : End;
    : : : : [/code]
    : : : :
    : : : : Hope this is what you need.
    : : : : Phat Nat
    : : : :
    : : : : PS - Thought you may want these too:
    : : : : [code]
    : : : : PROCEDURE ShowMouse; Assembler;
    : : : : ASM
    : : : : Mov Ax, $0001 { Function 1 = Show Mouse Cursor }
    : : : : Int $33 { Int $33 = Mouse Functions }
    : : : : End;
    : : : :
    : : : : PROCEDURE HideMouse; Assembler;
    : : : : ASM
    : : : : Mov Ax, $0000 { Function 0 = Hide Mouse Cursor }
    : : : : Int $33 { Int $33 = Mouse Functions }
    : : : : End;
    : : : : [/code]
    : : : :
    : : : :
    : : : :
    : : : :
    : : : :
    : : : :
    : : :
    : : :
    : : : Hi PhatNat,
    : : : thanks for your reply, as always. One question, Im trying to use this procedure in a pascal program:
    : : :
    : : : PROGRAM Mouze;
    : : : USES Crt;
    : : :
    : : :
    : : : PROCEDURE GetMouse(VAR MouseX, MouseY : Word; VAR MouseB : Byte); Assembler;
    : : : ASM
    : : : Mov Ax, $0003 { Function 3 = Get Mouse X,Y & Buttons }
    : : : Int $33 { Int $33 = Mouse Functions }
    : : : Shr Cx, 1 { Divide MouseX by 2 }
    : : : Les Di, MouseX { ES:DI = @MouseX }
    : : : Mov Es:[Di], Cx { MouseX is returned as 0-639, I want 0-319 }
    : : : Les Di, MouseY { ES:DI = @MouseY }
    : : : Mov Es:[Di], Dx { MouseY is returned as 0-199 }
    : : : Les Di, MouseB { ES:DI = @MouseB }
    : : : Mov Es:[Di], Bl { Mouse Buttons }
    : : : End;
    : : :
    : : : BEGIN
    : : : GetMouse;
    : : : END.
    : : :
    : : : When I try to compile this i get "Error 88:"(" Expected. Fro the bit of research i did i gather that not every procedure needs to be followed by a bracket... What should I put in the brackets?
    : : :
    : : : thx!
    : : : NA
    : : :
    : : The variables to receive the location of the mouse cursor and buttons, i.e.:
    : : [code]
    : : VAR MouseX, MouseY : Word; VAR MouseB : Byte
    : : [/code]
    : : as seen in the declaration of the procedure.
    : :
    : :
    :
    :
    : But I still have no way of knowing what MouseX and MouseY etc are? Simply entering these variables does not get me anywhere. What should I do to avoid this error "Error 88"?
    :
    : thx so much!
    : NA
    :
    You don't need to enter the variables. These variables are set by the procedure GetMouse(), and hold the location of the mouse. If you want to do something using the mouse position, you can read those variables.
    This example shows the mouse coordinates on the screen:
    [code]
    begin
    repeat
    GetMouse(MouseX, MouseY, MouseB); { Sets the variables }
    GotoXY(1, 1);
    writeln(MouseX, MouseY); { Uses the location }
    until MouseB > 0; { Checks if the user clicks to end the program }
    end;
    [/code]

  • : : : : : [b][red]This message was edited by Phat Nat at 2006-12-12 17:31:50[/red][/b][hr]
    : : : : : : 1. How do I use the mouse in pascal? Im trying to have a program react to the left and right mouse click...
    : : : : : :
    : : : : : : 2. Furthermore I am trying to store the information I collect in the way in a txt file. Ive programmed pascal to store keys the program user enters in a .dat file but i expect that this process will have no way of storing which mouse button is clicked just like it cannot store the left or right key stroke but uses an empty space to do this... Is there any way around this?
    : : : : : :
    : : : : :
    : : : : : For storing the Left & Right keystrokes you need to read READKEY twice. The first time will return a "0" (meaning extended function) and the second key will be the real keystroke value (75=Left 77=Right)
    : : : : : If these values are found, you could store them as characters 27 & 26 ( & ) for easier deciphering.
    : : : : :
    : : : : : As for the Mouse, if you're using TP7 this will work (as it supports inline assembly). It's not in a unit, but it will get the job done. It will give you the X, Y & Buttons of the mouse.
    : : : : : Mouse Buttons: Lf=1, Rt=2, Lf&Rt=3, Cn=4, Lf&Cn=5, etc
    : : : : :
    : : : : : [code]
    : : : : : PROCEDURE GetMouse(VAR MouseX, MouseY : Word; VAR MouseB : Byte); Assembler;
    : : : : : ASM
    : : : : : Mov Ax, $0003 { Function 3 = Get Mouse X,Y & Buttons }
    : : : : : Int $33 { Int $33 = Mouse Functions }
    : : : : : Shr Cx, 1 { Divide MouseX by 2 }
    : : : : : Les Di, MouseX { ES:DI = @MouseX }
    : : : : : Mov Es:[Di], Cx { MouseX is returned as 0-639, I want 0-319 }
    : : : : : Les Di, MouseY { ES:DI = @MouseY }
    : : : : : Mov Es:[Di], Dx { MouseY is returned as 0-199 }
    : : : : : Les Di, MouseB { ES:DI = @MouseB }
    : : : : : Mov Es:[Di], Bl { Mouse Buttons }
    : : : : : End;
    : : : : : [/code]
    : : : : :
    : : : : : Hope this is what you need.
    : : : : : Phat Nat
    : : : : :
    : : : : : PS - Thought you may want these too:
    : : : : : [code]
    : : : : : PROCEDURE ShowMouse; Assembler;
    : : : : : ASM
    : : : : : Mov Ax, $0001 { Function 1 = Show Mouse Cursor }
    : : : : : Int $33 { Int $33 = Mouse Functions }
    : : : : : End;
    : : : : :
    : : : : : PROCEDURE HideMouse; Assembler;
    : : : : : ASM
    : : : : : Mov Ax, $0000 { Function 0 = Hide Mouse Cursor }
    : : : : : Int $33 { Int $33 = Mouse Functions }
    : : : : : End;
    : : : : : [/code]
    : : : : :
    : : : : :
    : : : : :
    : : : : :
    : : : : :
    : : : : :
    : : : :
    : : : :
    : : : : Hi PhatNat,
    : : : : thanks for your reply, as always. One question, Im trying to use this procedure in a pascal program:
    : : : :
    : : : : PROGRAM Mouze;
    : : : : USES Crt;
    : : : :
    : : : :
    : : : : PROCEDURE GetMouse(VAR MouseX, MouseY : Word; VAR MouseB : Byte); Assembler;
    : : : : ASM
    : : : : Mov Ax, $0003 { Function 3 = Get Mouse X,Y & Buttons }
    : : : : Int $33 { Int $33 = Mouse Functions }
    : : : : Shr Cx, 1 { Divide MouseX by 2 }
    : : : : Les Di, MouseX { ES:DI = @MouseX }
    : : : : Mov Es:[Di], Cx { MouseX is returned as 0-639, I want 0-319 }
    : : : : Les Di, MouseY { ES:DI = @MouseY }
    : : : : Mov Es:[Di], Dx { MouseY is returned as 0-199 }
    : : : : Les Di, MouseB { ES:DI = @MouseB }
    : : : : Mov Es:[Di], Bl { Mouse Buttons }
    : : : : End;
    : : : :
    : : : : BEGIN
    : : : : GetMouse;
    : : : : END.
    : : : :
    : : : : When I try to compile this i get "Error 88:"(" Expected. Fro the bit of research i did i gather that not every procedure needs to be followed by a bracket... What should I put in the brackets?
    : : : :
    : : : : thx!
    : : : : NA
    : : : :
    : : : The variables to receive the location of the mouse cursor and buttons, i.e.:
    : : : [code]
    : : : VAR MouseX, MouseY : Word; VAR MouseB : Byte
    : : : [/code]
    : : : as seen in the declaration of the procedure.
    : : :
    : : :
    : :
    : :
    : : But I still have no way of knowing what MouseX and MouseY etc are? Simply entering these variables does not get me anywhere. What should I do to avoid this error "Error 88"?
    : :
    : : thx so much!
    : : NA
    : :
    : You don't need to enter the variables. These variables are set by the procedure GetMouse(), and hold the location of the mouse. If you want to do something using the mouse position, you can read those variables.
    : This example shows the mouse coordinates on the screen:
    : [code]
    : begin
    : repeat
    : GetMouse(MouseX, MouseY, MouseB); { Sets the variables }
    : GotoXY(1, 1);
    : writeln(MouseX, MouseY); { Uses the location }
    : until MouseB > 0; { Checks if the user clicks to end the program }
    : end;
    : [/code]
    :
    :

    and what type should these variables be? I tried string and integer, both didnt work...:(

  • : : : : : : [b][red]This message was edited by Phat Nat at 2006-12-12 17:31:50[/red][/b][hr]
    : : : : : : : 1. How do I use the mouse in pascal? Im trying to have a program react to the left and right mouse click...
    : : : : : : :
    : : : : : : : 2. Furthermore I am trying to store the information I collect in the way in a txt file. Ive programmed pascal to store keys the program user enters in a .dat file but i expect that this process will have no way of storing which mouse button is clicked just like it cannot store the left or right key stroke but uses an empty space to do this... Is there any way around this?
    : : : : : : :
    : : : : : :
    : : : : : : For storing the Left & Right keystrokes you need to read READKEY twice. The first time will return a "0" (meaning extended function) and the second key will be the real keystroke value (75=Left 77=Right)
    : : : : : : If these values are found, you could store them as characters 27 & 26 ( & ) for easier deciphering.
    : : : : : :
    : : : : : : As for the Mouse, if you're using TP7 this will work (as it supports inline assembly). It's not in a unit, but it will get the job done. It will give you the X, Y & Buttons of the mouse.
    : : : : : : Mouse Buttons: Lf=1, Rt=2, Lf&Rt=3, Cn=4, Lf&Cn=5, etc
    : : : : : :
    : : : : : : [code]
    : : : : : : PROCEDURE GetMouse(VAR MouseX, MouseY : Word; VAR MouseB : Byte); Assembler;
    : : : : : : ASM
    : : : : : : Mov Ax, $0003 { Function 3 = Get Mouse X,Y & Buttons }
    : : : : : : Int $33 { Int $33 = Mouse Functions }
    : : : : : : Shr Cx, 1 { Divide MouseX by 2 }
    : : : : : : Les Di, MouseX { ES:DI = @MouseX }
    : : : : : : Mov Es:[Di], Cx { MouseX is returned as 0-639, I want 0-319 }
    : : : : : : Les Di, MouseY { ES:DI = @MouseY }
    : : : : : : Mov Es:[Di], Dx { MouseY is returned as 0-199 }
    : : : : : : Les Di, MouseB { ES:DI = @MouseB }
    : : : : : : Mov Es:[Di], Bl { Mouse Buttons }
    : : : : : : End;
    : : : : : : [/code]
    : : : : : :
    : : : : : : Hope this is what you need.
    : : : : : : Phat Nat
    : : : : : :
    : : : : : : PS - Thought you may want these too:
    : : : : : : [code]
    : : : : : : PROCEDURE ShowMouse; Assembler;
    : : : : : : ASM
    : : : : : : Mov Ax, $0001 { Function 1 = Show Mouse Cursor }
    : : : : : : Int $33 { Int $33 = Mouse Functions }
    : : : : : : End;
    : : : : : :
    : : : : : : PROCEDURE HideMouse; Assembler;
    : : : : : : ASM
    : : : : : : Mov Ax, $0000 { Function 0 = Hide Mouse Cursor }
    : : : : : : Int $33 { Int $33 = Mouse Functions }
    : : : : : : End;
    : : : : : : [/code]
    : : : : : :
    : : : : : :
    : : : : : :
    : : : : : :
    : : : : : :
    : : : : : :
    : : : : :
    : : : : :
    : : : : : Hi PhatNat,
    : : : : : thanks for your reply, as always. One question, Im trying to use this procedure in a pascal program:
    : : : : :
    : : : : : PROGRAM Mouze;
    : : : : : USES Crt;
    : : : : :
    : : : : :
    : : : : : PROCEDURE GetMouse(VAR MouseX, MouseY : Word; VAR MouseB : Byte); Assembler;
    : : : : : ASM
    : : : : : Mov Ax, $0003 { Function 3 = Get Mouse X,Y & Buttons }
    : : : : : Int $33 { Int $33 = Mouse Functions }
    : : : : : Shr Cx, 1 { Divide MouseX by 2 }
    : : : : : Les Di, MouseX { ES:DI = @MouseX }
    : : : : : Mov Es:[Di], Cx { MouseX is returned as 0-639, I want 0-319 }
    : : : : : Les Di, MouseY { ES:DI = @MouseY }
    : : : : : Mov Es:[Di], Dx { MouseY is returned as 0-199 }
    : : : : : Les Di, MouseB { ES:DI = @MouseB }
    : : : : : Mov Es:[Di], Bl { Mouse Buttons }
    : : : : : End;
    : : : : :
    : : : : : BEGIN
    : : : : : GetMouse;
    : : : : : END.
    : : : : :
    : : : : : When I try to compile this i get "Error 88:"(" Expected. Fro the bit of research i did i gather that not every procedure needs to be followed by a bracket... What should I put in the brackets?
    : : : : :
    : : : : : thx!
    : : : : : NA
    : : : : :
    : : : : The variables to receive the location of the mouse cursor and buttons, i.e.:
    : : : : [code]
    : : : : VAR MouseX, MouseY : Word; VAR MouseB : Byte
    : : : : [/code]
    : : : : as seen in the declaration of the procedure.
    : : : :
    : : : :
    : : :
    : : :
    : : : But I still have no way of knowing what MouseX and MouseY etc are? Simply entering these variables does not get me anywhere. What should I do to avoid this error "Error 88"?
    : : :
    : : : thx so much!
    : : : NA
    : : :
    : : You don't need to enter the variables. These variables are set by the procedure GetMouse(), and hold the location of the mouse. If you want to do something using the mouse position, you can read those variables.
    : : This example shows the mouse coordinates on the screen:
    : : [code]
    : : begin
    : : repeat
    : : GetMouse(MouseX, MouseY, MouseB); { Sets the variables }
    : : GotoXY(1, 1);
    : : writeln(MouseX, MouseY); { Uses the location }
    : : until MouseB > 0; { Checks if the user clicks to end the program }
    : : end;
    : : [/code]
    : :
    : :
    :
    : and what type should these variables be? I tried string and integer, both didnt work...:(
    :
    :
    As you can see from this code:
    [code]
    PROCEDURE GetMouse(VAR MouseX, MouseY : [red]Word[/red]; VAR MouseB : [red]Byte[/red]);
    [/code]
    they must be [b]word[/b] and [b]byte[/b]. Var parameters [b][size=4]must be precisely the same[/size][/b] as specified in the procedure declaration.
  • : : : : : : : [b][red]This message was edited by Phat Nat at 2006-12-12 17:31:50[/red][/b][hr]
    : : : : : : : : 1. How do I use the mouse in pascal? Im trying to have a program react to the left and right mouse click...
    : : : : : : : :
    : : : : : : : : 2. Furthermore I am trying to store the information I collect in the way in a txt file. Ive programmed pascal to store keys the program user enters in a .dat file but i expect that this process will have no way of storing which mouse button is clicked just like it cannot store the left or right key stroke but uses an empty space to do this... Is there any way around this?
    : : : : : : : :
    : : : : : : :
    : : : : : : : For storing the Left & Right keystrokes you need to read READKEY twice. The first time will return a "0" (meaning extended function) and the second key will be the real keystroke value (75=Left 77=Right)
    : : : : : : : If these values are found, you could store them as characters 27 & 26 ( & ) for easier deciphering.
    : : : : : : :
    : : : : : : : As for the Mouse, if you're using TP7 this will work (as it supports inline assembly). It's not in a unit, but it will get the job done. It will give you the X, Y & Buttons of the mouse.
    : : : : : : : Mouse Buttons: Lf=1, Rt=2, Lf&Rt=3, Cn=4, Lf&Cn=5, etc
    : : : : : : :
    : : : : : : : [code]
    : : : : : : : PROCEDURE GetMouse(VAR MouseX, MouseY : Word; VAR MouseB : Byte); Assembler;
    : : : : : : : ASM
    : : : : : : : Mov Ax, $0003 { Function 3 = Get Mouse X,Y & Buttons }
    : : : : : : : Int $33 { Int $33 = Mouse Functions }
    : : : : : : : Shr Cx, 1 { Divide MouseX by 2 }
    : : : : : : : Les Di, MouseX { ES:DI = @MouseX }
    : : : : : : : Mov Es:[Di], Cx { MouseX is returned as 0-639, I want 0-319 }
    : : : : : : : Les Di, MouseY { ES:DI = @MouseY }
    : : : : : : : Mov Es:[Di], Dx { MouseY is returned as 0-199 }
    : : : : : : : Les Di, MouseB { ES:DI = @MouseB }
    : : : : : : : Mov Es:[Di], Bl { Mouse Buttons }
    : : : : : : : End;
    : : : : : : : [/code]
    : : : : : : :
    : : : : : : : Hope this is what you need.
    : : : : : : : Phat Nat
    : : : : : : :
    : : : : : : : PS - Thought you may want these too:
    : : : : : : : [code]
    : : : : : : : PROCEDURE ShowMouse; Assembler;
    : : : : : : : ASM
    : : : : : : : Mov Ax, $0001 { Function 1 = Show Mouse Cursor }
    : : : : : : : Int $33 { Int $33 = Mouse Functions }
    : : : : : : : End;
    : : : : : : :
    : : : : : : : PROCEDURE HideMouse; Assembler;
    : : : : : : : ASM
    : : : : : : : Mov Ax, $0000 { Function 0 = Hide Mouse Cursor }
    : : : : : : : Int $33 { Int $33 = Mouse Functions }
    : : : : : : : End;
    : : : : : : : [/code]
    : : : : : : :
    : : : : : : :
    : : : : : : :
    : : : : : : :
    : : : : : : :
    : : : : : : :
    : : : : : :
    : : : : : :
    : : : : : : Hi PhatNat,
    : : : : : : thanks for your reply, as always. One question, Im trying to use this procedure in a pascal program:
    : : : : : :
    : : : : : : PROGRAM Mouze;
    : : : : : : USES Crt;
    : : : : : :
    : : : : : :
    : : : : : : PROCEDURE GetMouse(VAR MouseX, MouseY : Word; VAR MouseB : Byte); Assembler;
    : : : : : : ASM
    : : : : : : Mov Ax, $0003 { Function 3 = Get Mouse X,Y & Buttons }
    : : : : : : Int $33 { Int $33 = Mouse Functions }
    : : : : : : Shr Cx, 1 { Divide MouseX by 2 }
    : : : : : : Les Di, MouseX { ES:DI = @MouseX }
    : : : : : : Mov Es:[Di], Cx { MouseX is returned as 0-639, I want 0-319 }
    : : : : : : Les Di, MouseY { ES:DI = @MouseY }
    : : : : : : Mov Es:[Di], Dx { MouseY is returned as 0-199 }
    : : : : : : Les Di, MouseB { ES:DI = @MouseB }
    : : : : : : Mov Es:[Di], Bl { Mouse Buttons }
    : : : : : : End;
    : : : : : :
    : : : : : : BEGIN
    : : : : : : GetMouse;
    : : : : : : END.
    : : : : : :
    : : : : : : When I try to compile this i get "Error 88:"(" Expected. Fro the bit of research i did i gather that not every procedure needs to be followed by a bracket... What should I put in the brackets?
    : : : : : :
    : : : : : : thx!
    : : : : : : NA
    : : : : : :
    : : : : : The variables to receive the location of the mouse cursor and buttons, i.e.:
    : : : : : [code]
    : : : : : VAR MouseX, MouseY : Word; VAR MouseB : Byte
    : : : : : [/code]
    : : : : : as seen in the declaration of the procedure.
    : : : : :
    : : : : :
    : : : :
    : : : :
    : : : : But I still have no way of knowing what MouseX and MouseY etc are? Simply entering these variables does not get me anywhere. What should I do to avoid this error "Error 88"?
    : : : :
    : : : : thx so much!
    : : : : NA
    : : : :
    : : : You don't need to enter the variables. These variables are set by the procedure GetMouse(), and hold the location of the mouse. If you want to do something using the mouse position, you can read those variables.
    : : : This example shows the mouse coordinates on the screen:
    : : : [code]
    : : : begin
    : : : repeat
    : : : GetMouse(MouseX, MouseY, MouseB); { Sets the variables }
    : : : GotoXY(1, 1);
    : : : writeln(MouseX, MouseY); { Uses the location }
    : : : until MouseB > 0; { Checks if the user clicks to end the program }
    : : : end;
    : : : [/code]
    : : :
    : : :
    : :
    : : and what type should these variables be? I tried string and integer, both didnt work...:(
    : :
    : :
    : As you can see from this code:
    : [code]
    : PROCEDURE GetMouse(VAR MouseX, MouseY : [red]Word[/red]; VAR MouseB : [red]Byte[/red]);
    : [/code]
    : they must be [b]word[/b] and [b]byte[/b]. Var parameters [b][size=4]must be precisely the same[/size][/b] as specified in the procedure declaration.
    :

    "MouseB" only recognized whether or not a mouse button has been pressed. What code will tell me whether someone pushed the LEFT mouse button or the RIGHT one?

  • : : : : : : : : [b][red]This message was edited by Phat Nat at 2006-12-12 17:31:50[/red][/b][hr]
    : : : : : : : : : 1. How do I use the mouse in pascal? Im trying to have a program react to the left and right mouse click...
    : : : : : : : : :
    : : : : : : : : : 2. Furthermore I am trying to store the information I collect in the way in a txt file. Ive programmed pascal to store keys the program user enters in a .dat file but i expect that this process will have no way of storing which mouse button is clicked just like it cannot store the left or right key stroke but uses an empty space to do this... Is there any way around this?
    : : : : : : : : :
    : : : : : : : :
    : : : : : : : : For storing the Left & Right keystrokes you need to read READKEY twice. The first time will return a "0" (meaning extended function) and the second key will be the real keystroke value (75=Left 77=Right)
    : : : : : : : : If these values are found, you could store them as characters 27 & 26 ( & ) for easier deciphering.
    : : : : : : : :
    : : : : : : : : As for the Mouse, if you're using TP7 this will work (as it supports inline assembly). It's not in a unit, but it will get the job done. It will give you the X, Y & Buttons of the mouse.
    : : : : : : : : Mouse Buttons: Lf=1, Rt=2, Lf&Rt=3, Cn=4, Lf&Cn=5, etc
    : : : : : : : :
    : : : : : : : : [code]
    : : : : : : : : PROCEDURE GetMouse(VAR MouseX, MouseY : Word; VAR MouseB : Byte); Assembler;
    : : : : : : : : ASM
    : : : : : : : : Mov Ax, $0003 { Function 3 = Get Mouse X,Y & Buttons }
    : : : : : : : : Int $33 { Int $33 = Mouse Functions }
    : : : : : : : : Shr Cx, 1 { Divide MouseX by 2 }
    : : : : : : : : Les Di, MouseX { ES:DI = @MouseX }
    : : : : : : : : Mov Es:[Di], Cx { MouseX is returned as 0-639, I want 0-319 }
    : : : : : : : : Les Di, MouseY { ES:DI = @MouseY }
    : : : : : : : : Mov Es:[Di], Dx { MouseY is returned as 0-199 }
    : : : : : : : : Les Di, MouseB { ES:DI = @MouseB }
    : : : : : : : : Mov Es:[Di], Bl { Mouse Buttons }
    : : : : : : : : End;
    : : : : : : : : [/code]
    : : : : : : : :
    : : : : : : : : Hope this is what you need.
    : : : : : : : : Phat Nat
    : : : : : : : :
    : : : : : : : : PS - Thought you may want these too:
    : : : : : : : : [code]
    : : : : : : : : PROCEDURE ShowMouse; Assembler;
    : : : : : : : : ASM
    : : : : : : : : Mov Ax, $0001 { Function 1 = Show Mouse Cursor }
    : : : : : : : : Int $33 { Int $33 = Mouse Functions }
    : : : : : : : : End;
    : : : : : : : :
    : : : : : : : : PROCEDURE HideMouse; Assembler;
    : : : : : : : : ASM
    : : : : : : : : Mov Ax, $0000 { Function 0 = Hide Mouse Cursor }
    : : : : : : : : Int $33 { Int $33 = Mouse Functions }
    : : : : : : : : End;
    : : : : : : : : [/code]
    : : : : : : : :
    : : : : : : : :
    : : : : : : : :
    : : : : : : : :
    : : : : : : : :
    : : : : : : : :
    : : : : : : :
    : : : : : : :
    : : : : : : : Hi PhatNat,
    : : : : : : : thanks for your reply, as always. One question, Im trying to use this procedure in a pascal program:
    : : : : : : :
    : : : : : : : PROGRAM Mouze;
    : : : : : : : USES Crt;
    : : : : : : :
    : : : : : : :
    : : : : : : : PROCEDURE GetMouse(VAR MouseX, MouseY : Word; VAR MouseB : Byte); Assembler;
    : : : : : : : ASM
    : : : : : : : Mov Ax, $0003 { Function 3 = Get Mouse X,Y & Buttons }
    : : : : : : : Int $33 { Int $33 = Mouse Functions }
    : : : : : : : Shr Cx, 1 { Divide MouseX by 2 }
    : : : : : : : Les Di, MouseX { ES:DI = @MouseX }
    : : : : : : : Mov Es:[Di], Cx { MouseX is returned as 0-639, I want 0-319 }
    : : : : : : : Les Di, MouseY { ES:DI = @MouseY }
    : : : : : : : Mov Es:[Di], Dx { MouseY is returned as 0-199 }
    : : : : : : : Les Di, MouseB { ES:DI = @MouseB }
    : : : : : : : Mov Es:[Di], Bl { Mouse Buttons }
    : : : : : : : End;
    : : : : : : :
    : : : : : : : BEGIN
    : : : : : : : GetMouse;
    : : : : : : : END.
    : : : : : : :
    : : : : : : : When I try to compile this i get "Error 88:"(" Expected. Fro the bit of research i did i gather that not every procedure needs to be followed by a bracket... What should I put in the brackets?
    : : : : : : :
    : : : : : : : thx!
    : : : : : : : NA
    : : : : : : :
    : : : : : : The variables to receive the location of the mouse cursor and buttons, i.e.:
    : : : : : : [code]
    : : : : : : VAR MouseX, MouseY : Word; VAR MouseB : Byte
    : : : : : : [/code]
    : : : : : : as seen in the declaration of the procedure.
    : : : : : :
    : : : : : :
    : : : : :
    : : : : :
    : : : : : But I still have no way of knowing what MouseX and MouseY etc are? Simply entering these variables does not get me anywhere. What should I do to avoid this error "Error 88"?
    : : : : :
    : : : : : thx so much!
    : : : : : NA
    : : : : :
    : : : : You don't need to enter the variables. These variables are set by the procedure GetMouse(), and hold the location of the mouse. If you want to do something using the mouse position, you can read those variables.
    : : : : This example shows the mouse coordinates on the screen:
    : : : : [code]
    : : : : begin
    : : : : repeat
    : : : : GetMouse(MouseX, MouseY, MouseB); { Sets the variables }
    : : : : GotoXY(1, 1);
    : : : : writeln(MouseX, MouseY); { Uses the location }
    : : : : until MouseB > 0; { Checks if the user clicks to end the program }
    : : : : end;
    : : : : [/code]
    : : : :
    : : : :
    : : :
    : : : and what type should these variables be? I tried string and integer, both didnt work...:(
    : : :
    : : :
    : : As you can see from this code:
    : : [code]
    : : PROCEDURE GetMouse(VAR MouseX, MouseY : [red]Word[/red]; VAR MouseB : [red]Byte[/red]);
    : : [/code]
    : : they must be [b]word[/b] and [b]byte[/b]. Var parameters [b][size=4]must be precisely the same[/size][/b] as specified in the procedure declaration.
    : :
    :
    : "MouseB" only recognized whether or not a mouse button has been pressed. What code will tell me whether someone pushed the LEFT mouse button or the RIGHT one?
    :
    :
    Probably by the number returned in the MouseB. Just test it, by showing the results of MouseB on the screen.
  • : :
    :
    : "MouseB" only recognized whether or not a mouse button has been pressed. What code will tell me whether someone pushed the LEFT mouse button or the RIGHT one?
    :
    :

    As written before:
    : Mouse Buttons: Lf=1, Rt=2, Lf&Rt=3, Cn=4, Lf&Cn=5, etc

    The values tell you what button has been pressed. (Although I've found some computers don't recognize pressing the center button in DOS)
    If you know binary, basically the Left button is bit 0, the right is bit 1 and the center is bit 2.
    MouseB = xxxxxCRL

    Phat Nat
  • : : :
    : :
    : : "MouseB" only recognized whether or not a mouse button has been pressed. What code will tell me whether someone pushed the LEFT mouse button or the RIGHT one?
    : :
    : :
    :
    : As written before:
    : : Mouse Buttons: Lf=1, Rt=2, Lf&Rt=3, Cn=4, Lf&Cn=5, etc
    :
    : The values tell you what button has been pressed. (Although I've found some computers don't recognize pressing the center button in DOS)
    : If you know binary, basically the Left button is bit 0, the right is bit 1 and the center is bit 2.
    : MouseB = xxxxxCRL
    :
    : Phat Nat
    :


    Thanks - i catually figered that one out... One more question: Ive noticed that GetMouse cannot work with MouseB unless MouseX and MouseY are added to its brackets... If they are not there I get a type mismatch. Why is that?

  • : : : :
    : : :
    : : : "MouseB" only recognized whether or not a mouse button has been pressed. What code will tell me whether someone pushed the LEFT mouse button or the RIGHT one?
    : : :
    : : :
    : :
    : : As written before:
    : : : Mouse Buttons: Lf=1, Rt=2, Lf&Rt=3, Cn=4, Lf&Cn=5, etc
    : :
    : : The values tell you what button has been pressed. (Although I've found some computers don't recognize pressing the center button in DOS)
    : : If you know binary, basically the Left button is bit 0, the right is bit 1 and the center is bit 2.
    : : MouseB = xxxxxCRL
    : :
    : : Phat Nat
    : :
    :
    :
    : Thanks - i catually figered that one out... One more question: Ive noticed that GetMouse cannot work with MouseB unless MouseX and MouseY are added to its brackets... If they are not there I get a type mismatch. Why is that?

    With Pascal, you must assign a variable when a procedure/function has it declared in it's header (Unlike Visual Basic, etc)
    If you mean when you remove them from the Procedure declaration, it will give a fault because inside the procedure tries to access MouseX, MouseY. You would need to remove any lines in the procedure relating to MouseX, MouseY
    [code]
    Shr Cx, 1 { Divide MouseX by 2 }
    Les Di, MouseX { ES:DI = @MouseX }
    Mov Es:[Di], Cx { MouseX is returned as 0-639, I want 0-319 }
    Les Di, MouseY { ES:DI = @MouseY }
    Mov Es:[Di], Dx { MouseY is returned as 0-199 }
    [/code]

    Otherwise all you really need to do is:
    [code]
    VAR
    Junk : Word;
    Buttons : Byte;
    Begin
    GetMouse(Junk,Junk,Buttons);
    End.
    [/code]
    This will just throw the results into a junk variable.

    Phat Nat
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories