Using the mouse wheel

I would like to use the mouse wheel in an Windows 95 application. I'm unable to intercept the WM_MOUSEWHEEL message (because it's unsupported under Windows 95). How can I do?
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

Blondie050798Connect With a Mentor Commented:
The document does explain (although not very well!)

The framework calls this member function as a user rotates the mouse wheel and encounters the wheel's next notch. Unless overridden, OnRegisteredMouseWheel registers the Windows message, routes the message to the appropriate window, and calls the WM_MOUSEWHEEL handler for that window.

It is far easier to understand what is going on by looking at the source used by mfc, and simply 'do your own thing' as required!

So looking at the mfc source:

// register for Windows 95 or Windows NT 3.51
static UINT nMsgMouseWheel =
   (((::GetVersion() & 0x80000000) && LOBYTE(LOWORD(::GetVersion()) == 4)) ||
       (!(::GetVersion() & 0x80000000) && LOBYTE(LOWORD(::GetVersion()) == 3)))
       ? ::RegisterWindowMessage(MSH_MOUSEWHEEL) : 0;

and then in the message map:
ON_REGISTERED_MESSAGE(nMsgMouseWheel, OnRegisteredMouseWheel)

and then the actual source:
LRESULT CFrameWnd::OnRegisteredMouseWheel(WPARAM wParam, LPARAM lParam)
      // convert from MSH_MOUSEWHEEL to WM_MOUSEWHEEL

      WORD keyState = 0;
      keyState |= (::GetKeyState(VK_CONTROL) < 0) ? MK_CONTROL : 0;
      keyState |= (::GetKeyState(VK_SHIFT) < 0) ? MK_SHIFT : 0;

      LRESULT lResult;
      HWND hwFocus = ::GetFocus();
      const HWND hwDesktop = ::GetDesktopWindow();

      if (hwFocus == NULL)
            lResult = SendMessage(WM_MOUSEWHEEL, (wParam << 16) | keyState, lParam);
            do {
                  lParam = ::SendMessage(hwFocus, WM_MOUSEWHEEL,
                        (wParam << 16) | keyState, lParam);
                  hwFocus = ::GetParent(hwFocus);
            while (lParam == 0 && hwFocus != NULL && hwFocus != hwDesktop);
      return lResult;
You have to use OnRegisteredMouseWheel()
bonduelAuthor Commented:
I know that, but what is the way to use OnRegisteredMouseWheel (there is no message WM_REGISTEREDMOUSEWHEEL).
bonduelAuthor Commented:
Thank U
All Courses

From novice to tech pro — start learning today.