VB6 Application mouse scroll wheel

Posted on 2007-10-01
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

    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

    here's what i use... makes life easy
    ' modWheelMouse_OCX Module
    ' ------------------------
    ' Created By  : Kevin Wilson
    '        ( The VB Zone )
    '        ( 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

    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

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Window placement 17 56
    0ffice 2016 not printing 6 50
    Determine Range to Select 5 26
    vb6 connector to SQL Server 2 21
    Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
    When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    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…

    755 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now