|
Home Site Structure Programming Home Basic Home GUI & OS Home QB Knowledge Base Professor Answers Codename Surena QB Downloads Write Us
Special LinksQB DirectoryNEW Codename Surena Forums |
|
||
How to use mouse? For calling mouse functions, you should load the function number in register AX and the parameters (if any) in other registers, as described here, and then call interrupt service &H33. Note that the code samples in this article assume that you have declared a variable of type "RegType" named "Regs". Remember that for using "INTERRUPT" routine as well as "RegType" type, you should include "QB.BI" or "QBX.BI" include files: '$INCLUDE: 'QB.BI' 'or '$INCLUDE: 'QBX.BI'
Initializing and Detecting the Mouse Driver Regs.AX = 0 CALL INTERRUPT (&H33, Regs, Regs) IF AX = -1 THEN 'The driver is installed. ELSE 'The driver is not installed. END IF
Showing and Hiding the Mouse Pointer Regs.AX = 1 CALL INTERRUPT (&H33, Regs, Regs) Function 2 hides the mouse pointer. Regs.AX = 2 CALL INTERRUPT (&H33, Regs, Regs)
Retrieving the coordinates of the Mouse Pointer and the State of the Mouse
Buttons CONST mbLeftButton = 1 CONST mbRightButton = 2 CONST mbMiddleButton = 4 Regs.AX = 3 CALL INTERRUPT (&H33, Regs, Regs) 'The mouse pointer is located at (Regs.CX, Regs.DX) IF BX AND mbLeftButton THEN 'The left button is pressed. END IF IF BX AND mbRightButton THEN 'The right button is pressed. END IF IF BX AND mbMiddleButton THEN 'The middle button is pressed. END IF
Setting the Position of the Mouse Pointer Regs.AX = 4 Regs.CX = 100 Regs.DX = 100 CALL INTERRUPT (&H33, Regs, Regs)
Setting the limits of the Mouse Pointer Regs.AX = 7 Regs.CX = 100 Regs.DX = 200 CALL INTERRUPT (&H33, Regs, Regs) Regs.AX = 8 Regs.CX = 100 Regs.DX = 200 CALL INTERRUPT (&H33, Regs, Regs) |