COXIntelliMouse
Copyright © The Code Project 1997 - 1998, All Rights Reserved

A lot of popular applications such as Internet Explorer or Microsoft Excel have support for advanced scrolling functionality. But you probably even haven't noticed it because it's available only if you have Microsoft IntelliMouse (generally, any three-button mouse which is quite rare case now). IntelliMouse has special wheel turning using which you can scroll the contents of the active window. But if you click on this wheel it will act as common mouse middle button. The most interesting thing is what happens after you click on the mouse wheel. 

E.g. Internet Explorer will do the following: if opened page has vertical and/or horizontal scrollbar(s) then it will display non-rectangular splash window in shape of target and if you move mouse it will scroll the contents of the page in the corresponding direction (if it's possible to scroll). Note that simultaneous scrolling in vertical and horizontal directions is supported. Moreover, the far you move mouse from the point where Intelli Mouse Support was started the faster the contents will be scrolled (ballistic scrolling). 

We implemented all above described functionality in our COXIntelliMouse class. COXIntelliMouse is derived from COXHookWnd and uses internally COXSplashWnd class. Also in order to visually display the direction of the scrolling when Intelli Mouse Support is on COXIntelliMouse class uses set of cursors that is defined in "OXIntelliMouse.rc" file. 

Note: you have to include in "Resource Includes"-"Compile Time Directives" of your application's resource file reference to "OXIntelliMouse.rc"

Following technique should be applied in order to provide Intelli Mouse Support in your application using COXIntelliMouse class: 

1) Instantiate one object of COXIntelliMouse class for every window class for which you are going to provide Intelli Mouse Support.

	Example: 
	class CMyView : public CView			
	{ 
		. . . . . . . . . . . . . . 
	protected: 
		// intelli mouse support 
		COXIntelliMouse m_IntelliMouse;  
		. . . . . . . . . . . . . . 
	}		

2) In OnCreate function of such window class call COXIntelliMouse::Attach function in order to register it with COXIntelliMouse object and to set up the start event that will be interpreted as trigger to launch Intelli Mouse Support.

	Example: 
	int CMyView::OnCreate(LPCREATESTRUCT lpCreateStruct)			
	{ 
		. . . . . . . . . . . . . . 
		// mouse left button down altogether 
		// with "Ctrl" key pressed down 
		// will launch Intelli Mouse Support
		m_IntelliMouse.Attach(this,WM_LBUTTONDOWN,KEYPRESSED_CONTROL); 
		. . . . . . . . . . . . . . 
	}		

3) That's it.