Learn how to a build a cloud-first strategyRegister Now


VB6 Application mouse scroll wheel

Posted on 2007-10-01
Medium Priority
Last Modified: 2013-12-20
Is it possible to get a VB6 application in XP or VISTA to respond to the mouse scroll wheel?
I have seen how the VB6 IDE can get to see it but not the VB6 controls.
Question by:rcbridger
LVL 22

Expert Comment

ID: 19994613
You need to subclass the control using the hWnd Property and trap message WM_MOUSEWHEEL.
Here is an example of doing it on the Form.
For other controls just change the hWnd.


You may also want to use a more robust subclasser such as this one:

Also see these links for more info:
LVL 32

Accepted Solution

Robberbaron (robr) earned 1000 total points
ID: 19995063
here's what i use... makes life easy
' modWheelMouse_OCX Module
' ------------------------
' Created By  : Kevin Wilson
'               http://www.TheVBZone.com   ( The VB Zone )
'               http://www.TheVBZone.net   ( The VB Zone .net )
' Last Update : June 14, 2000
' VB Versions : 5.0 / 6.0
' Requires    : MSGHOO32.OCX (MsgHook OLE Custom Control Module)
'               A Microsoft Intellimouse (or compatible wheel mouse)
' Description : This module was created to make it possible to easily trap mouse wheel events that are sent
'               to the specified form using the FreeWare ActiveX control "MSGHOO32.OCX".  Using this control
'               to process the messages sent to the specified form makes the VB IDE more stable when debugging
'               code.  When you sub-class a form to process the messages sent to it, it debugging the code
'               very difficult and tends to crash the VB IDE if something goes wrong with the sub-class or
'               if you forget to unsub-class the form.

Author Comment

ID: 20018627
I didn't like the idea of the VB IDE crashing so I tried the MSGHOO32.OCX method and it seems to work very well, thanks.

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month20 days, 19 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question