home *** CD-ROM | disk | FTP | other *** search
- Cmouse.cpp for Borland C++
- ==========================
-
-
- Thank you for downloading cmouse.zip. Compile and run
- cmouse.cpp which includes demo code. A mouse interrupt
- handler is provided and should serve most all your
- needs. To use cmouse.cpp in your own application,
- comment out "#define TEST_CMOUSE_CPP" near the end of
- the cmouse.cpp file.
-
- The MicrosoftMouse class provides member functions for
- all Microsoft Mouse Driver functions packaged in a
- convenient interface. Do not instantiate any instances
- of the class - instead access them through MM, the only
- instance of MicrosoftMouse!
-
- For example:
-
- #include <stdio.h>
- #include <cmouse.hpp>
-
- main()
- {
- MM.show();
- MM.autoEventUpdate();
- while (!MM.leftPressed) do;
- puts("Mouse's left button pressed.");
- return 0;
- }
-
- All omouse coordinates are expressed in Borland C++'s
- physical screen coordinates rather than the mouse's
- virtual coordinates. Be sure to call MM.reset() after
- each video mode change to enable this feature!
-
- Since MM is a global instance of the MicrosoftMouse
- class, its constructor and destructor take care of
- preparing the mouse for use in your program.
-
- Look at the MicrosoftMouse class declaration in
- cmouse.hpp. You will soon notice that the member
- functions don't typically pass parameters but values
- are instead stored directly in the MM instance's data
- fields. The reason I don't pass parameters is so you
- don't have to provide variables to store them in.
- Secondly, cmouse has a special function called
- autoEventUpdate() that activates a prewritten mouse
- event interrupt handler. All you do is call
- MM.autoEventUpdate() and it updates the MM's data
- fields whenever a mouse event happens as specified
- by MM.eventMask. The mask is preconfigured to request
- an update whenever the mouse moves, or a mouse button
- is pressed or released. That way your application
- simply poles these fields for updates. This should
- satisfy most of your requirements. If you need
- something more sophisticated, you can use the code
- of autoEventHandler() to cookbook your interrupt
- handler!
-
- For example:
-
-
- MM.x = 10; MM.y = 20; MM.gotoxy();
-
- // moves the mouse cursor to (10,20).
-
-
- MM.updateStatusInfo()
- if (MM.leftPressed)
- // if left button pressed.
-
-
- If you are wondering what the total effect of calling
- MM.updateStatusInfo() is you can study the source. If
- you want to do any serious mouse programming it would
- be a good idea to pick up
-
- "Microsoft Mouse Programmer's Reference."
- Bellevue, Washington: Microsoft Press, 1989.
-
- This is the main reference I used in coding cmouse.
- Rather than repeat what is in this book or explain what
- the mouse functions do, you should reference this book.
- By using the book and reading the header of cmouse,
- you will soon get the picture of what's going on.
-
-
- Of course if you had activated the provided mouse
- interrupt handler, all you would have to do to see if
- the left button was pressed is test the field:
-
-
- if (MM.leftPressed)
- // if left button pressed.
-
-
- To enable the mouse interrupt handler, you must
- call MM.autoEventUpdate(). Check the demo code to see
- if you can find this. Also study the display of the
- demo. It displays many of the fields of MM. Use
- the mouse and see how these fields register the changes.
- The function MouseReport() in the demo produces this
- report. Look there to see how the fields are accessed.
-
-
- I have tested the omouse unit with Microsoft Mouse
- driver version 7.00 and Microsoft's second generation
- serial mouse as well as the ATI VGA Wonder Plus bus
- mouse. If the demo won't run in graphics mode the
- most likey cause is your mouse driver doesn't support
- the more advanced features of your graphics card. I
- know, you have a paint program that works fine with
- your mouse and driver so it must be cmouse. Well many
- paint programs provide their own builtin drivers to
- keep you from calling them with the same problem.
- Believe me, call your mouse manufacturer and get the
- latest driver. If you must call me, don't call in the
- middle of the night, please!
-
-
- Super VGA Modes
- ===============
-
- At this time I am awaiting information from VESA for
- VESA compliant SVGA modes. When I do I'll update
- cmouse for those modes. In the mean time if you want
- to try it yourself you must modify Xcell[], Ycell[],
- LeftTopOfs[], virtualX(), virtualY(), physicalX(),
- and physicalY(). The standard modes documented in
- the Microsoft Mouse Programmer's Reference are for
- video modes 0-13 hex. This made it easy to implement
- Xcell, Ycell, and LeftTopOfs in arrays. I'm thinking
- that I will simply remap modes 23, 27, 33, 37, 54, 6A,
- 61, 62, 63, 65, and 67 hex into MM.vmode just above
- 13 hex so that these arrays can simply be extended.
- I use these arrays to automatically convert between
- physical screen coordinates and mouse virtual
- coordinates.
-
-
-
- Registration
- ============
-
- If you find cmouse useful and are using it in your
- applications, tell your friends. You don't need to
- register cmouse -- it's freeware! All I ask is that
- you leave my copyright notice intact!
-
-
-
-
- Thanks again!
-
-
- John W. Small
- CIS: 73757,2233
-
- PSW / Power SoftWare
- P.O. Box 10072
- McLean, VA 22102 8072
- (703) 759-3838
-
-
-