Window not receiving WM_MOUSEWHEEL or it is not sent to window at all and I don't understand why RRS feed

All replies

  • Hi forever a loser,

    Thank you for your post. The WM_MOUSEWHEEL message is sent to the window with focus. Please mark sure your window is focused when the mouse wheel is rotated.

    If your window doesn't have input control to get focused. WM_MOUSEWHEEL message will not be received.

    Best Regards,
    Li Wang

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Thursday, October 20, 2016 5:34 AM
  • Thank you for your post. The WM_MOUSEWHEEL message is sent to the window with focus. Please mark sure your window is focused when the mouse wheel is rotated.

    I have already verified and made sure that, i.e. I did verify and make* sure that.

    If your window doesn't have input control to get focused. WM_MOUSEWHEEL message will not be received.

    It's an animated FPS game, i.e. frames per second, and it shouldn't have any input control on it, e.g. Textbox (Edit Control), CheckBox, ComboBox (DropDownList), ListBox, ListView, TreeBox, TreeView, etc, but it does CreateDIBSection, draws over it by writing directly to it's bits and then renders it to the window's client via BitBlt function. WM_MOUSEWHEEL doesn't require any input control(s) on the window in order to be received, and I know that, because I speak from my experience. I have already done an experiment, where I created an empty window (a window without any input control) and only when it was focused or I was focused on that window (when it's border was emphasized on the screen) and rotated my mouse wheel, the WM_MOUSEWHEEL message was sent. I did show a MessageBox on that event. In my real project of the game, where the issue still persists, I put a breakpoint under WM_MOUSEWHEEL code line, but when I rotate my mouse wheel (up and down), the application/program doesn't reach the breakpoint, i.e. it was not reached, when I debugging my game.

    Did you have a look in the source code I posted at all?

    Thursday, October 20, 2016 9:13 AM
  • Did you have a look in the source code I posted at all?

    Do you really expect people to sift through almost 2,000 lines of source code?
    Thursday, October 20, 2016 9:33 AM
  • Take your time. I don't limit on time. I am always trying to solve this problem myself, but I can't figure out why WM_MOUSEWHEEL message is neither sent nor received. That's a very strange issue. Do you have any suggestion how can I present my issue simpler? My suggestion is to look only at WinMain and WinProc functions to see if there is a problem between the Win32 calls.
    Thursday, October 20, 2016 11:02 AM
  • Can you reproduce the problem in a small test application?


    Thursday, October 20, 2016 2:10 PM
  • Can you reproduce the problem in a small test application?


    I have already did it, but after I did it and executed it, there was no problem with WM_MOUSEWHEEL at all. It just worked. The message was sent and received to the window with no problem. This is my first time I encounter this issue only in this big application.

    There is the small test application that I already did, but as I said already it works fine, no problem found there:

    #include <Windows.h>
    #include <windowsx.h>
    	switch (Msg)
    		case WM_MOUSEWHEEL: MessageBox(hWnd, GET_WHEEL_DELTA_WPARAM(wParam) > 0 ? "wheel up" : "wheel down", "Exclamation", MB_ICONEXCLAMATION | MB_OK); break;
    		default: return DefWindowProc(hWnd, Msg, wParam, lParam);
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
    	SetWindowLongPtr(hWnd, GWL_WNDPROC, &WinProc);
    	MSG msg = {0};
    	while (GetMessage(&msg, hWnd, 0, 0) > 0)
    Thursday, October 20, 2016 2:30 PM
  • Note that I asked if you could reproduce the problem in a small test application.

    Since you have a working application, compare the window creation and message handling to see what you're doing differently in the problem application.


    Thursday, October 20, 2016 4:28 PM
  • The difference between the two applications is that in my real project, I handle more messages than just WM_MOUSEWHEEL, i.e. there are more cases in the switch statement of my WinProc function for WM_COMMAND, WM_SYSCOMMAND, WM_SIZE, WM_SIZING, WM_KEYDOWN, WM_LBUTTONDOWN and WM_RBUTTONDOWN.

    The small test application only handles the WM_MOUSEWHEEL message. Both return the call of DefWindowProc function in the default statement by passing all the parameters of WinProc function, i.e. hWnd, Msg, wParam and lParam. But the additional messages my application handles doesn't relate to WM_MOUSEWHEEL, so why WM_MOUSEWHEEL still not working then? That's what I don't understand. I scan my code millions of times, and I don't see what is not okay.

    Thursday, October 20, 2016 6:13 PM
  • I had similar problem in my OpenGL app. In order to disable main OpenGL window before showing some dialog windows, I used 

    EnableWindow(myhandle, false);

    Later, I enabled window with same function and true parameter.

    Unexpectedly, WM_MOUSEWHEEL stopped working, although window looked focused. WM_MOUSEMOVE, clicks, keyboard and probably all other events worked OK. The solution was to call :


    after enabling window.

    Hope this helps.

    Wednesday, August 15, 2018 6:12 PM
  • Hello Guys

    Currently i am migrating one of my MFC applications to Windows10 64Bit from Windows7 32 bit.Suddenly my mousewheel stopped working.

    The same code works in the application on windows 7 .

    Can anyone pls advise ?

    //Mouse registration 

    m_hMouseHook = SetWindowsHookEx( WH_MOUSE, &MouseHookProc, AfxGetInstanceHandle(), GetCurrentThreadId() );

    //Hookproc callback
    LRESULT CALLBACK MouseHookProc(int nCode, WPARAM wParam, LPARAM lParam)
    CPPUITrace objTrace(_T("CPostProcUIControlsDialog::MouseHookProc"));

    objTrace.LogError(_T("Madhu::Got wParam %d and nCode is %d"),wParam,nCode); //GEtting mousemove events but not mousescroll,
    if (nCode > 0)
    if (wParam == WM_MOUSEWHEEL)

    objTrace.LogError(_T("Madhu::Got wParam %d"), wParam);


    Wednesday, January 22, 2020 10:25 AM
  • Hi

    Did you solve this issue in your application


    Wednesday, January 22, 2020 2:04 PM