Middle mouse button my ASCII...

by Pete (Login The-Universe)
Admin

 
Does anyone have a program that works with there middle mouse button using CALL INTERRUPT?

I have two infra-red mice and neither will accept the code for a the middle mouse button:

Sample routine -

DECLARE SUB MDRIVER (EX, B$)

TYPE RegType
AX AS INTEGER
BX AS INTEGER
CX AS INTEGER
DX AS INTEGER
BP AS INTEGER
SI AS INTEGER
DI AS INTEGER
FLAGS AS INTEGER
DS AS INTEGER
ES AS INTEGER
END TYPE

DIM SHARED MOUSE$
DIM SHARED Registers AS RegType
DIM SHARED LB, RB, MB, DX, CX, IDENTIFY

SCREEN 0, 0, 0, 0
FOR i = 1 TO 25
COLOR i MOD 16
LOCATE i, 1: PRINT i;
NEXT
COLOR 7, 0
EX = 1: CALL MDRIVER(EX, B$)
DO
EX = 2: CALL MDRIVER(EX, B$)
LOOP UNTIL INKEY$ = CHR$(27) OR B$ <> ""
EX = -1: CALL MDRIVER(EX, B$)
SYSTEM

SUB MDRIVER (EX, B$)
STATIC MOUSEACT

REM INITIATE MOUSE
IF MOUSEACT = 0 THEN
Registers.AX = 0: GOSUB CALLI
MOUSEACT = 1
END IF

IF EX = 1 THEN
Registers.AX = 1: GOSUB CALLI
EXIT SUB
END IF

IF EX = -1 THEN
REM HIDES MOUSE IF A KEY WAS PRESSED FOR NEXT MOUSE LOOP
Registers.AX = 2: GOSUB CALLI
EXIT SUB
END IF

Registers.AX = 3: GOSUB CALLI

REM MOUSE LOCATION (USES X AND Y TO CONVERT TO 25 * 80 SCREEN SIZE)
DX = Registers.DX
CX = Registers.CX
X = DX \ 8 + 1: Y = CX \ 8 + 1

REM MOUSE BUTTONS
LB = Registers.BX AND 1
RB = (Registers.BX AND 2) \ 2
MB = (Registers.BX AND 4) \ 4

IF LB <> 0 THEN
IDENTIFY = SCREEN(X, Y, 1)
LOCATE 1, 6: PRINT SPACE$(74);
LOCATE 1, 6: PRINT "Position:"; X; "x"; Y; " Color Attribute:"; IDENTIFY
END IF

IF MB <> 0 THEN
LOCATE 1, 47: PRINT "Middle Button";
END IF

IF RB <> 0 THEN
LOCATE 1, 67: PRINT "Right Button";
END IF


EXIT SUB

CALLI:
CALL INTERRUPT(&H33, Registers, Registers)
RETURN

END SUB

Posted on Jun 15, 2010, 9:17 PM

Respond to this message   

Return to Index

Response TitleAuthor and Date
* The middle button works on my 98 machine. Not my XP.Clippy on Jun 15
 * The OS or I wonder if it has something to do with the mouse driver?Pete on Jun 15
This SUB should display 3 buttonsClippy on Jun 15
 Thanks, I ran it and it returned 2 buttons.Pete on Jun 16
  * Your welcome. I use LOCATE before the SUB call to place the PRINTs.Clippy on Jun 16

 Copyright © 1999-2014 Network54. All rights reserved.   Terms of Use   Privacy Statement