02-25-2004, 01:29 AM
I find most ASM mouse routines really don't work w/QB4.5, so here is a great mouse routine with some data:
So-if ur not using a library, please use these routines (unless u don't have QB4.x or better...contact me [hint, hint])
That is all
Oz
Code:
Defint a-z
'$include: 'QB.BI'
Type MouseType
b as integer
x as integer
y as integer
end type
Const true = -1, false = 0
Declare sub MouseDriver(ax,bx,cx,dx)
Declare function MouseInit()
screen 0
cls
dim mouse as mousetype
if (mouseinit=false) then
print "unable to detect mouse"
end
end if
do
MouseDriver 3,mouse.b,mouse.x,mouse.y '3 is code for Get Data
'Mouse.b:
'1=Left Button
'2=Right Button
'3=Middle Button
'4=Left & Right Button
'5=Left & Middle Button
'6=Right & Middle Button
'7=All 3 Buttons
'Write your variable handling
'Wait Graphics-
'Hide Mouse
MouseDriver 2,0,0,0
'Write your graphic handling
'Show Mouse
MouseDriver 1,0,0,0
loop until Mouse.b
end
SUB MouseDriver(ax,bx,cx,dx)
'AX:
'1 = mouse show - MouseDriver 1, 0, 0, 0
'2 = mouse hide - MouseDriver 2, 0, 0, 0
'3 = get data - MouseDriver 3, Buttons, X, Y
'4 = put mouse - MouseDriver 4, 0, x, y
'5 = (i can't remeber)
'6 = (i can't remeber)
'7 = max x - MouseDriver 7, 0, minx, maxx
'8 = max y - MouseDriver 8, 0, miny, maxy
'9-22 = (i can't figure out)
'>22 = (these will give you errors, and crash ur computer)
dim RegData(1 to 2) as RegType
'Input Data
RegData(1).AX=ax
RegData(1).BX=bx
RegData(1).CX=cx
RegData(1).DX=dx
'51 is the mouse interrupt number
Call Interrupt(51,RegData(1),RegData(2))
ax=RegData(2).AX
bx=RegData(2).BX
cx=RegData(2).CX
dx=RegData(2).DX
END SUB
Function MouseInit ()
MouseDriver MouseInit,0,0,0
END FUNCTION
So-if ur not using a library, please use these routines (unless u don't have QB4.x or better...contact me [hint, hint])
That is all
Oz