Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mouse

Status
Not open for further replies.

qbasicking

Programmer
Aug 19, 2001
628
US
I am using this code to run the mousedriver for my GUI:

DECLARE SUB Mousestatus (lb%,rb%,xmouse%,ymouse%)
DECLARE SUB Mousehide ()
DECLARE SUB Mousedriver (ax%,bx%,cx%,dx%)
DECLARE SUB Mouseshow ()
DIM SHARED mouse$
Mouse$ = SPACE$(57)
FOR n% = 1 to 57
READ a$
h$ = CHR$(VAL("&H"+a$))
MID$(Mouse$, n%, 1) = h$
NEXT
DATA 55,89,E5,8B,5E,0C,8B,07,50,8B,5E,0A,8B,07,50,8B
DATA 5E,08,8B,0F,8B,5E,06,8B,17,5B,58,1E,07,CD,33,53
DATA 8B,5E,0C,89,07,58,8B,5E,0A,89,07,8B,5E,08,89.0F
DATA 8B,5E,06,89,17,5D,CA,08,00
SCREEN 12
Mousedriver 4,0,320,240
Mouseshow
WHILE x$ = INKEY$
Mousestatus lb%,rb%,x%,y%
LOCATE 1,1
PRINT lb%,rb%,x%,y%
x$ = INKEY$
WEND

SUB Mousedriver (ax%,bx%,cx%,dx%)
DEF SEG = VARSEG(Mouse$)
Mouse$ = SADD(Mouse$)
CALL Absolute(ax%,bx%,cx%,dx%,Mouse%)
END SUB

SUB Mousehide
Mousedriver 2,0,0,0
END SUB

SUB Mouseshow
Mousedriver 1,0,0,0
END SUB

SUB Mousestatus (lb%,rb%,xmouse%,ymouse%)
Mousedriver 3,bx%,cx%,dx%
lb% = ((bx% AND 1)<>0)
rb% = ((bx% AND 2)<>0)
xmouse% = cx%
ymouse% = dx%
END SUB

Does anybody know who to modify this to use the scrollwheel or the centre button?
 
Hi there,
I dont know any thing about the scroll wheel but i know about the centre button. In the MouseStatus sub just put the statement:
mb% = ((bx% AND 4)\4)

And why do u use Call Absolute??? Use call Interrupt using interrupt #33[i.e 0x33 or 51(that's in decimal) or &h33(that's in qb)]

Use the following 'general' command to use mouse routines through qb.(4.5 or 7.1)

CALL INTERRUPT (&H33, INREGS, OUTREGS)

INREGS.AX = 0 'INITIALIZES THE MOUSE
INREGS.AX = 1 'SHOWS THE MOUSE POINTER
INREGS.AX = 2 'HIDES THE MOUSE POINTER
INREGS.AX = 3 'GETS THE MOUSE POSITION IN CX(X co-ordinate),
DX(Y co-ordinate) and BX(Button Status)

Also OUTREGS.AX will return 0 if mouse driver is not present.

The above r essentials and if u want to know more mail me ok???

 
I have used something like your code in the past, but I am writing in qb1.1 at the time and mine is just more stable and easier to use since I have been using it longer.
Thank you for the code for the centre button.

I still want that code for the scroll wheel.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top