New Version 2.2 March 15, 2005 This Page Viewed: times.
Here is the latest version that contains an optional parameter to turn off the MouseWheel for Subforms.MouseWheelHookA2K.zip Please note the calling convention has changed for the MouseOff function. See the code behind the sample Form. NOTE: The A97 MouseWHeelHook.zip below DOES NOT contain the newest version of the MouseHook DLL. I am no longer updating the older A97 specific code. You can certainly use the MouseHook DLL in an A97 application.
MouseWheelHook is an MDB demonstrating how to use a MouseHook to turn off the MouseWheel. No more MouseWheel.DLL Hell! No DLL registration required. The MouseHook DLL is a standard Windows DLL. Do not try to Register it or set a Reference to it from within Access. Just copy the included MouseHook.DLL into your Windows/System folder or into the same folder as your application MDB. One instance handles all Forms and SubForms so only call the functions once from a SINGLE Form.
Here is sample code that can be placed behind CommandButton controls. You could also place this code in the Load event of a single Form. Remember you need to call these functions only ONE TIME. The MouseHook will look after the MouseWheel messages for all forms that you have open now or at any time during your current session. Remember to turn the MouseWheel back on before you exit the current session!
Private Sub Command14_Click()
Or if you will be running multiple instances of Access then you can pass an optional parameter to ask for a Global Hook. The default is FALSE. Please note the Version documentation below.
blRet = MouseWheelOFF(True)
Access 97 Version
MouseWheelHook97.zip is an MDB demonstrating how to use a MouseHook to turn off the MouseWheel.
Yes, the version numbers on the sample MDB have finally been updated to reflect reality. What is of importance is that the DLL has a creation date of March 2005. Please note the calling convention for the MouseOff function have changed to accomodate an optional parameter to allow you to turn off the MouseWheel completely for SubForms.
Please note the Optional GlobalHook BOOLEAN parameter.
Please note this is an update from the March 09/04 release. Support has now been added for Logitech Mice. The only difference between the feature set for a MS Mouse and a Logitech Mouse is that you can scroll an open Combo control from a MS Mouse only. Look at the code behind the sample Forms to see how to turn the MouseWheel ON or Off. You need to import into your own MDB the standard code module "modMouseHook" found in the sample MDB included in the download zip file. Bug Fix for SubForms with ScrollBars. Bug fix for SubForms without visible ScrollBars. Added support to specify an optional Global versus thread specific hook to allow for multiple instances of Access.
Bug fix. The SubForm ScrollBar fix in 2.5 created a new issue for SubForms with Visible ScrollBars.
Bug Fix. I don't know why but in my sample Forms I had never created a SubForm without Scrollbars. Keith Broaddrick was kind enough to point out that in a SubForm without ScrollBars the MouseWheel would still be able to scroll through the recordset. Keeping my fingers crossed that this is the last bug fix for a while!<grin>
Mistakenly had commented out code to support forms in Popup view in version 2.3. Added support for Popup forms back in this release.
The hook now works with all versions of Windows after Win95. (Will add WIn95 support in the next release.)
Verified the hook works with MS Access ADP Forms.
The following Bug had nothing to do with my code. Through testing I have verified this a bug with Access 97 under Windows 98 using an Intellimouse driver. It is repeatable with any MDB whether you use or do not use my hook. The Bug can result in an endless loop under a set of very specific circumstances( when the MouseWheel is rolled as fast as possible within a TextBox control). I have only ever seen this bug under the aforementioned specific system setup.
Changed from a MouseHook to a MessageHook to allow for support of Logitech Mice.
Now correctly handles Tab and Option Group controls. Removed Bug that would at times allow a multiline TextBox control to pass the MouseWheel messages onto the Form. Allows users to Scroll within a ComboBox control. Allows MouseWheel to work in SubForms. Leaves all non Access Form windows alone! The logic in the DLL was completely rewritten. Works with all Access Form controls.
**Remember to remove any existing instances of the MouseHook.DLL from your system. When you call the code from your Form it first looks into your Windows/System folder for the MouseHook.DLL. If it is not found then it will look into the folder where the current MDB resides. This means if you copy the newest version of the DLL into your application folder but still have an older version in your Windows/System folder the OLDER version will be used!**
Robert Pascale writes: Worth noting that in an Access 2000 ADP (instead of an
MDB) you cannot use the "currentdb" functions.
Below is the older subclassing ActiveX DLL based method. Use the MouseWheelHook solution above instead!
NEW VERSION - October 15/2002 - Unregister and Delete all previous versions of the MouseWheel.DLL on your system before registering this new version! This version finally supports use in SubForms! Thank you to Terry Kreft for supplying the fix!
MouseWheelOnOff.zip is a database containing sample code to enable the user/develop to programmatically turn on or turn off the MouseWheel. There is no current reference in the sample MDB to the MouseWheel.DLL file. If you try to open the sample Form you will receive an error message. You must follow the instructions below, or those on the sample Form to initially register the DLL.
Here is the VB6 Source code used to build the Subclassing DLL. MouseWheelVBsource.zip
MouseWheelOnOff is a database containing sample code to enable the user/developer to:
' Adapted from MS KB Article ID: Q278379