Announcement

Collapse
No announcement yet.

Generic mouse?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Generic mouse?

    I have several routines for the mouse that are +very+ specific-
    that is, it is written assuming the mouse is two- button, or is
    three-button, and specifically expects the mouse to be connected
    to the com port so specified in the routine.

    Mouse use programming is new to me. Is there a general routine
    that will "look" for the mouse (even if it is plugged into USB),
    and at least the left & right buttons will work regardless of
    the brand of mouse (Logitech, Microsoft, Gateway, etc.)??

    While I have a five button optical mouse, all I really need is
    for the program to recognize the left and right mouse buttons,
    and where on the screen it was clicked or double-clicked.

    Is a working generic routine of this possible?

    Thank you.

    Robert Carneal

    ------------------

  • #2
    Generally speaking, mouses (not mice!) will come with a DOS "driver", and these usually always provide an INT &H33 interface.

    Therefore, it should not be relevant whether the mouse is a USB, Serial, or uses some other interface method, as long as the driver provides an INT &H33 interface. If your code uses the INT &H33 interface (ala, MOUSUNIT.BAS, etc), then you should have no problems.


    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      Therefore, it should not be relevant whether the mouse is a
      USB, Serial, or uses some other interface method, as long as
      the driver provides an INT &H33 interface. If your code uses
      the INT &H33 interface (ala, MOUSUNIT.BAS, etc), then you should
      have no problems.


      Lance-

      I follow what you are saying. My mouse is a USB but when I use
      MOUSEUNIT, it fails. That is what made me think USB mouses did
      not work. Now, based on what you are saying, I would say I am
      probably not using MOUSEUNIT properly. When I compile, it says
      "Cannot compile as unit."

      Hmm, how would I find out if the mouse driver uses an INT &H33
      interface? It is an optical mouse, if that makes a difference.
      I am not sure what that error means yet.

      Thank you.




      ------------------

      Comment


      • #4
        Lance- yay- Mouseunit works. It is +me+ that is not using it
        correctly. Rather than print possibly copyrighted code here,
        let me try this. When I use the procedure MsButtons it returns
        to me the correct number of buttons. [5] When I use IsThere,
        however, it returns a negative number. Shouldn't that number be
        positive to indicate True? [I automatically think Positive is
        true, and negative is false.]

        When I use MsStatus,however, it threw a curve ball at me. It
        said I may need "ByCopy."

        I didn't see that in the user's guide nor the help. What is that
        and how do I use it? Do I need it to get the location of mouse
        when a left/right button was pressed? (I won't say ByCopy is not
        in the user's guide, because every time I say something is not
        in the guide I get shot down. )

        Thank you.

        [This message has been edited by Robert Carneal (edited February 22, 2003).]

        Comment


        • #5
          Robert,

          FYI, returning a negative number (usually "-1") is the equivalent
          in the programming world of returning a positive number to indicate
          a TRUE result. To my knowledge, returning a zero ("0") is always
          the case when returning FALSE.



          ------------------

          Comment


          • #6
            PB/DOS has the ISTRUE and ISFALSE functions; IMO it would a good habit to use these functions instead of "equals" when testing for true or false conditions.

            MCM
            Michael Mattias
            Tal Systems Inc. (retired)
            Racine WI USA
            [email protected]
            http://www.talsystems.com

            Comment


            • #7
              Robert,

              It said I may need "ByCopy."
              ByCopy is a way of passing parameters to a procedure, just like ByVal or ByRef, so in the docs it's under CALL and / or SUB / FUNCTION (i don't remember exactely now).

              If you get the above error message you should check the type of parameters in the call against the parameters in the procedure definition.

              ------------------
              Davide Vecchi
              [email protected]

              Comment


              • #8
                This is for Clay Clear please.

                Clay-

                returning a negative number (usually "-1") is the equivalent
                in the programming world of returning a positive number to indicate
                a TRUE result.
                I was trained as a programmer back in the days prior to Windows.
                At the college where I went, the professors drilled into us:
                -1 (or any negative number) False
                0 (zero)Error
                1 (or any positive number) True

                I guess it was professor specific, but that is where my
                programming "habits" came from. Thanks for clearing that up- I
                would still be considering that false if you had not written.

                Robert

                ------------------

                Comment


                • #9
                  What language was your professor trying to teach?

                  I got my start way back in the days of the old TRS-80 Model I, and TRUE has always been indicated by an integer "-1" (and FALSE, always by integer "0") in every dialect of BASIC I've ever tangled with...

                  (IIRC, this has to do with the various functions, such as IF/THEN, returning a 2-byte integer value consisting of either all bits high for TRUE, or all bits low for FALSE, and this return value subsequently being interpreted and displayed by the BASIC interpreter as a signed integer...)

                  ------------------
                  "Too often those in the high-tech industry view their work as an unquestionable contribution to the greater good, without regard to long-term effects on the way we all live."
                  --Chad Dickerson, InfoWorld CTO

                  Comment


                  • #10
                    Gary- I am allowing the thread to get off subject- but to
                    answer your question, he was teaching "Compact" which later
                    became todays C++, PL1, and one I have never seen
                    anywhere but at that school called PB (Not powerbasic, but
                    PERSONAL Basic), Fortran (prior to Fortran 77), Cobol, assembler,
                    dBase, RPG, etc. He had a rule- If IBM did not recognize the
                    language for their programming department- he would not teach it.

                    Had the school had another programming professor, I believe I
                    would have realized which habits where professor preferred. As
                    it was, he was anti-Microsoft I never saw a Win operating system
                    until after I graduated.

                    ------------------

                    Comment

                    Working...
                    X