MOUSE?

 BBS: Inland Empire Archive
Date: 02-07-93 (16:31)             Number: 367
From: JOHN GALLAS                  Refer#: NONE
  To: GREG DINERT                   Recvd: NO  
Subj: MOUSE?                         Conf: (2) Quik_Bas
GD>How do you make a program in QuickBasic that uses a mouse? What does it
GD>look like? Or can't you? Please help!

Try this:


'-----------------------------<cut here>----------------------------
'HSMOUSE.BAS  by Matt E. Hart
'
' Uses Int 33h calls to operate the mouse.
' Note that this is NOT a complete reference, Get the
' Microsoft Mouse Programmer's Guide at your local
' bookstore.

    DEFINT A-Z

    ' $INCLUDE: 'QB.BI'

    DECLARE SUB MouseShow ()
    DECLARE SUB MouseHide ()
    DECLARE FUNCTION MouseInit ()
    DECLARE FUNCTION MouseLeftButton ()
    DECLARE FUNCTION MouseRightButton ()

    DIM SHARED InRegs AS RegTypeX
    DIM SHARED OutRegs AS RegTypeX

    CLS
    MouseThere = MouseInit
    IF MouseThere THEN
        MouseShow
        DO
        LOOP UNTIL MouseLeftButton
        MouseHide
    END IF
    END

SUB MouseHide
    InRegs.ax = 2
    CALL INTERRUPTX(&H33, InRegs, OutRegs)
END SUB

FUNCTION MouseInit
    InRegs.ax = 0
    CALL INTERRUPTX(&H33, InRegs, OutRegs)
    MouseInit = OutRegs.ax
END FUNCTION

FUNCTION MouseLeftButton
    InRegs.ax = 5
    InRegs.bx = 0
    CALL INTERRUPTX(&H33, InRegs, OutRegs)
    MouseLeftButton = (OutRegs.ax = 1)
END FUNCTION

FUNCTION MouseRightButton
    InRegs.ax = 5
    InRegs.bx = 1
    CALL INTERRUPTX(&H33, InRegs, OutRegs)
    MouseRightButton = (OutRegs.ax = 1)
END FUNCTION

SUB MouseShow
    InRegs.ax = 1
    CALL INTERRUPTX(&H33, InRegs, OutRegs)
END SUB


 * OLX 2.1 TD * Read this sentance over again from the beginning.

--- TMail v1.30.4
 * Origin: TC-AMS MLTBBS 2.2 - Minnetonka, MN (612)-938-4799 (1:282/7)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET