IntelliMouse is a Microsoft invention that allows you to pan and zoom data in a window using the middle mouse button. The idea saw its light when the new mouse-wheel appeared on Microsoft mouse hardware, and using different combinations of scrolling, clicking and the CTRL and SHIFT keys, one can pan, zoom and scale windows with the middle mouse-button (or mouse-wheel).
The IntelliMouse SDK (there is actually an IntelliMouse SDK) defines the following actions:
|Wheel button click and drag||Panning|
|Wheel button click||Autoscroll|
Scrolling and zooming seems logical actions for the mouse, but "Autoscroll"? These are actually subtle features in various Internet Explorer and Office products. IE lets you move back and forward in the URL history, and Office also defines some neat behaviours in different views.
On some systems the IntelliMouse system may seem to already magically work on all applications you load.
This is because it has the IntelliMouse mouse driver installed. This
driver hooks up all child windows and adds scroll support for many of them,
ListView controls, and seems to
translate scrolling into
messages if the application doesn't handle the middle mouse itself.
On systems without this driver, you'll have to add the support yourself.
To obtain the "MS Office 97 Logo approval" your application was actually required to support IntelliMouse (I don't think any product have been discarded because of this feature though... or for any missing feature for that matter). This is of course a promotional stunt, but don't be afraid to add cool user-friendly navigation to your own application. Lack of mouse-wheel support is just something that annoys users who are used to work in MS Office products.
How to use itThe sample contains a generic class,
CIntelliMouseImplwhich has the basic implementation of an IntelliMouse system. Your software probably requires a different / custom method of scrolling the view, so re-defining the scrolling mechanism, the way movement is communicated to the view window or the way the scrolling speed is determined, might be needed. To do this, you derive from the
CIntelliMouseImplclass and implement your own custom IntelliMouse class where all the scrolling rules are defined.
This will basically just be a simple class where you override the following callback methods:
The base class calls the
void OnInstall(HWND) int OnCalculate(POINT, SIZE&) void OnMove(POINT) void OnZoom(POINT) void OnScroll(POINT) void OnDataScroll(POINT)
OnCalculatemethod to determine the scrolling speed/movement and the shape of the cursor (arrow points in the direction of the scroll). The remaining methods are called when one of the IntelliSense actions should be carried out. Internally these actions will probably end up calling
OnCalculateto help them asses how much to scroll.
To use the class, add your
CIntelliMouseXXX member variable to a window class
and call the installation method.
Now, all you need to do is click on the middle mouse button.
CIntelliMouseXXX m_Pan; ... m_Pan.Install(m_hWnd)
Your window should include support for some kind of scrolling. The sample class provided in the
download file simply manipulates the existing scrollbars in the parent class, and thus
assuming that both
being handled and enabled in the parent.
The code subclasses the parent window (identified by
Install method). It does this to monitor messages that
causes the panning to be cancelled. Be carefull if you override message
handlers for the mouse button actions in the main view, because the IntelliMouse
system must be able to handle them as well.
Source Code DependenciesMicrosoft Visual C++ 6.0
Microsoft WTL 7.0 Library
|Source Code and Sample (103 Kb)|