主题:哈哈,再晒一个QB程序(鼠标显示程序)
REM 注意:
REM DOS下要先运行mouse.com
REM 进入QB时要带上参数 /l 如:QB /l
DECLARE SUB Mouseinit ()
DECLARE SUB QBMouse (a%, b%, c%, d%)
DECLARE SUB MouseOn ()
'$INCLUDE: 'QB.BI'
COMMON SHARED MEXIST AS INTEGER
COMMON SHARED MONOFF AS INTEGER
DIM key$
SCREEN 0
Mouseinit
MouseOn
CLS
LOCATE 10, 20
PRINT "You can see the MOUSE POINT on the sreen"
LOCATE 25
PRINT "Press Esc to end!"
DO
key$ = INKEY$
LOOP UNTIL key$ = CHR$(27)
SUB Mouseinit
i% = 0: CALL QBMouse(i%, 0, 0, 0)
IF i% THEN MEXIST% = 1 ELSE MEXIST% = 0
END SUB
SUB MouseLeft (i%, x%, y%)
IF MEXIST% = 0 THEN EXIT SUB
CALL QBMouse(3, i%, x%, y%): i% = i% AND 1
END SUB
SUB MouseMove (x%, y%)
IF MEXIST% THEN CALL QBMouse(4, 0, x%, y%)
END SUB
SUB MouseOff '隐藏鼠标光标
IF MONOFF% = 0 THEN EXIT SUB ELSE MONOFF% = 0
IF MEXIST% THEN CALL QBMouse(2, 0, 0, 0)
END SUB
SUB MouseOn '显示鼠标光标
IF MONOFF% THEN EXIT SUB ELSE MONOFF% = 1
IF MEXIST% THEN CALL QBMouse(1, 0, 0, 0)
END SUB
SUB MouseRelease (i%)
IF MEXIST% THEN CALL QBMouse(6, i%, 0, 0)
END SUB
SUB MouseRight (i%)
IF MEXIST% = 0 THEN EXIT SUB
CALL QBMouse(3, i%, 0, 0): i% = i% AND 2
END SUB
SUB MouseXY (x%, y%)
IF MEXIST% THEN CALL QBMouse(3, 0, x%, y%)
END SUB
SUB QBMouse (a%, b%, c%, d%) STATIC
DIM M1 AS RegType, M2 AS RegType
M1.ax = a%: M1.bx = b%: M1.cx = c%: M1.dx = d%
CALL INTERRUPT(&H33, M1, M2)
a% = M2.ax: b% = M2.bx: c% = M2.dx: d% = M2.dx
END SUB
REM DOS下要先运行mouse.com
REM 进入QB时要带上参数 /l 如:QB /l
DECLARE SUB Mouseinit ()
DECLARE SUB QBMouse (a%, b%, c%, d%)
DECLARE SUB MouseOn ()
'$INCLUDE: 'QB.BI'
COMMON SHARED MEXIST AS INTEGER
COMMON SHARED MONOFF AS INTEGER
DIM key$
SCREEN 0
Mouseinit
MouseOn
CLS
LOCATE 10, 20
PRINT "You can see the MOUSE POINT on the sreen"
LOCATE 25
PRINT "Press Esc to end!"
DO
key$ = INKEY$
LOOP UNTIL key$ = CHR$(27)
SUB Mouseinit
i% = 0: CALL QBMouse(i%, 0, 0, 0)
IF i% THEN MEXIST% = 1 ELSE MEXIST% = 0
END SUB
SUB MouseLeft (i%, x%, y%)
IF MEXIST% = 0 THEN EXIT SUB
CALL QBMouse(3, i%, x%, y%): i% = i% AND 1
END SUB
SUB MouseMove (x%, y%)
IF MEXIST% THEN CALL QBMouse(4, 0, x%, y%)
END SUB
SUB MouseOff '隐藏鼠标光标
IF MONOFF% = 0 THEN EXIT SUB ELSE MONOFF% = 0
IF MEXIST% THEN CALL QBMouse(2, 0, 0, 0)
END SUB
SUB MouseOn '显示鼠标光标
IF MONOFF% THEN EXIT SUB ELSE MONOFF% = 1
IF MEXIST% THEN CALL QBMouse(1, 0, 0, 0)
END SUB
SUB MouseRelease (i%)
IF MEXIST% THEN CALL QBMouse(6, i%, 0, 0)
END SUB
SUB MouseRight (i%)
IF MEXIST% = 0 THEN EXIT SUB
CALL QBMouse(3, i%, 0, 0): i% = i% AND 2
END SUB
SUB MouseXY (x%, y%)
IF MEXIST% THEN CALL QBMouse(3, 0, x%, y%)
END SUB
SUB QBMouse (a%, b%, c%, d%) STATIC
DIM M1 AS RegType, M2 AS RegType
M1.ax = a%: M1.bx = b%: M1.cx = c%: M1.dx = d%
CALL INTERRUPT(&H33, M1, M2)
a% = M2.ax: b% = M2.bx: c% = M2.dx: d% = M2.dx
END SUB