VB6 Scroll Wheel Fix
Scroll Wheel Fix for VB6 (and others!)
This is a small program that will make your mouse's scroll wheel work in various older programs - mainly Visual Basic 6's code window. I noticed a lot of people coming to this site from Google looking for help with their mouse wheel. So, I decided to fix it.
It is possible to support many programs by adjusting its INI file. The included INI file includes support for:
It also supports horizontal scrolling if your mouse supports it, or by holding CTRL while scrolling vertically.
The scroll speed for each application can be adjusted by modifying the INI file. It should be fairly self explanitory: just edit the values for VertMsgCount and HorzMsgCount for your program's settings. Fractional values like 1.6 and negative values work just fine! Keep in mind that the program simulates clicking the arrows on a scrollbar, so entering a value of 0.1 will not give you more fine grained control. Instead you'll just have to scroll more to get 1 scroll message sent. But newer mice may work better with the fractional values.
Download the latest version:
C++ Source: VB6ScrollWheelFixSource7.zip
Just unzip the files somewhere convenient for you. That's all! Delete them to uninstall.
3/7/2008: I was asked to make a couple enhancements, and I went a little overboard. The program now has an INI that contains configuration options, supports multiple programs, supports mice that suport horizontal scrolling, and better follows Microsofts Best Practices.
C++ Source: VB6ScrollWheelFixSource7.zip
1/22/2004: Yet another fix! If you split the window, the scroll wheel would only move the lower scrollbar. I fixed it by testing for a second visible vertical scrollbar, and testing the mouse's position against the top scrollbar's bottom edge
C++ Source: VB6ScrollWheelFixSource4.zip
1/17/2004: I found that in certain cases the Control key "sticks". I noticed it mostly when using Ctrl-F to open the Find window. Since Ctrl-F opens a new window, my program was missing the Control key's KEY_UP message. Instead of modifying my code to catch all keyboard messages, I removed the keyboard hook portion completely. Since I only care about the 1 key, I just use GetAsyncKeyState(VK_CONTROL) which works better.
C++ Source: VB6ScrollWheelFixSource3.zip
1/14/2004: I was asked to slightly modify the program's behavior. Now, if you hold down the Control key, then the mouse's scroll wheel will affect the horizontal scrollbar instead of the vertical.
C++ Source: VB6ScrollWheelFixSource2.zip
C++ Source: VB6ScrollWheelFixSource.zip
Start up "VB6ScrollWheelFix.exe", and then use your mouse wheel in VB6. That's all! The program puts an icon in your task bar that looks like a red mouse. When you want to quit the program, right click the icon and choose "Quit".
How It Works:
Using Spy++, I found that the code windows were getting WM_MOUSEWHEEL events, but no WM_VSCROLL messages were being fired. So, I wrote a simple message hook that fires the scrolling events when it catches mouse wheel events.
I know from Spy++ that the code window's class is "VbaWindow", so I can use that to make sure that I only process those events. I just use the GetClassName function on each message's HWND, and ignore anything from anything but the VB6 code window.
Then, I just need to send WM_VSCROLL messages to the window. But since the window's scrollbars have their own HWND, I need to find those first. So, I use the FindWindow function to find child windows with the class name "ScrollBar". If I find one, then I use GetWindowLong to retrieve the window's style. If the style has the SBS_VERT bit set, then I know I have the correct scrollbar. And that's it in a nutshell!
Also, I cheated and took a picture of my mouse for the program's icon. Hey, I'm no artist! But it looks nice! :)
The scroll wheel also doesn't work in the resource editing windows, with class name "DesignerWindow". But, while Spy++ shows WM_MOUSEWHEEL messages being sent to those windows, my program never gets them. If I can figure out why, it's simple to fire WM_VSCROLL messages for that window too.