By: Jack Hoxley
Written: June 2000
Using the mouse really only benefits
two main use:
- C/C++ developers who already
have to program their own mouse control (to a certain extent).
- VB developers that are using
the Win32 libraries to create their own forms. See Win32
To a standard VB developer, the
form window will probably provide enough control of the mouse for all but the
most complicated programs. The DirectInput mouse section does make it easier
to get information about the mouse; including scroll wheels and additional buttons.
There is one big down side to
it all though; you cant use it if you're using the Win32 Window library (see
above). This is because this program requires the use of DirectXEvent - which
can only be declared in an object module (ie, a form; not a module or class).
Which makes it slightly pointless to use the Win32 libraries as shown on my
page.... oh well...
DirectInput mouse can handle
up to 4 buttons and 3 axis:
- Button0 and Button1 are the
normal Left/Right buttons. Button2 and Button3 are found on the more flashy
mice -Button2 tends to either be the scrollwheel button or the middle button.
Despite what you may have heard/read, VB can only use up to 4 buttons. C++
on the other hand can use up to 8.
- AxisX and AxisY are the normal
Left/Right/Up/Down entries. Axis Z represents the movement on the Z axis.
It is unlikely that you'll need the Z axis.
When you use DirectInput Mouse
you will be responsible for the mouse completely. Whilst the mouse is in your
control windows will ignore it - it wont track it's position, it wont show the
default cursor, and it wont send any messages about it (to you or other applications).
It is therefore possible to gain a lot of control form this; you have to read
the mouse coordinates; and you have to set the sensitivity - allowing you to
customise the mouse's behaviour, and you can also set the cursor easily - allowing
for animated cursors (nothing particularly new).
Because of the way the tutorial
is designed it is better for you to download it. It is very well commented,
and will explain everything you need to know. You can get it from the top of
this page; or from my downloads page.