News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

WM_MOUSEWHEEL Failure

Started by peaslee, June 11, 2012, 01:16:48 AM

Previous topic - Next topic

peaslee

I can get my program to scroll properly, but it doesn't want to recognize WM_MOUSEWHEEL. Is there something I must do before attempting it?


   .elseif iMsg == WM_MOUSEWHEEL
;           --------------------
      invoke MessageBox, hDlg, chr$("Test1"), chr$("Test"), 0
      mov    eax, wParam
      sar eax, 16
      .if SDWORD PTR eax > 0
         invoke SendMessage, hDlg, WM_VSCROLL, SB_LINEUP, 0
      .else
         invoke SendMessage, hDlg, WM_VSCROLL, SB_LINEDOWN, 0
      .endif


The message box does not appear.

dedndave

i have been doing some wheel stuff recently, too

i noticed a couple things...
first - the window must have focus

in my program, i have a main window
inside that is a child window with a trackbar for zoom

when the program opened, the wheel worked fine
after i clicked on the trackbar and moved it, the wheel stopped working
as it turned out - the trackbar took focus
i fixed it by adding a SetFocus,hChild at the end of the trackbar handler

another thing that i found was that, according to the documentation...
QuoteThe DefWindowProc function propagates the message to the window's parent.
There should be no internal forwarding of the message, since DefWindowProc
propagates it up the parent chain until it finds a window that processes it.

oddly enough, i could not get wheel messages in the child WndProc
i put my wheel code in WndProc for the main window to get it to work

this may help...
instead of using a MessageBox, just use a short Beep to tell if you are getting messages
works ok, unless you are using Vista - then use MessageBeep

peaslee

That solved it.

I had read that the window needed the focus, but when I put SetFocus in WM_INITDIALOG it didn't work. I now add it at the two places at the end of the IF statements where one indicates whether or not the message was handled.

I guess almost anything in the IF statements causes the window to lose focus.

Thanks for the help.