News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

WM_MOUSEMOVE

Started by dc, February 27, 2024, 05:57:03 AM

Previous topic - Next topic

dc

ive noticed that my app is processing WM_MOUSEMOVE message constantly whether the mouse moves or not... is this normal?

jj2007

No. Can you post complete code, so that we can check?

dc

my code is 45 MB so i cant
would the wireless mouse be sending consantly?

dc

ok i get the same thing with this code

NoCforMe

Maybe this thread should be moved to the Win32 forum? More relevant there.
Assembly language programming should be fun. That's why I do it.

jj2007

Quote from: dc on February 27, 2024, 07:05:12 AMok i get the same thing with this code

include \masm32\include\masm32rt.inc
...
;============================================================================
    .ElseIf uMsg==WM_MOUSEMOVE
        print "+"
; no good:            Invoke MessageBox, NULL,ADDR szMouseMove, Offset szAppName, MB_OK
;============================================================================

Use "console assembly and link".

Another option:
    .ElseIf uMsg==WM_MOUSEMOVE
invoke Sleep, 100
Invoke MessageBox, NULL,ADDR szMouseMove, Offset szAppName, MB_OK

Hit Escape repeatedly to close the MessageBoxes. After a while, activity will stop if you don't move the mouse.

What is indeed odd is that at the beginning, the message appears frequently without any moves. Perhaps the changes of the mouse cursor trigger that message, too. Weird.

mabdelouahab

    .ElseIf uMsg==WM_MOUSEMOVE
    mov eax,lParam
    .if eax!=oldP
    mov oldP,eax
  Invoke MessageBox, NULL,ADDR szMouseMove, Offset szAppName, MB_OK   
    .endif

dc

i have a work around but it seems strange that so much clock-time goes that way... seems like maybe half

TimoVJL

OutputDebugString is useful for tracing and is in Win32 API.
Just download Debugview or similar from somewhere.
May the source be with you

NoCforMe

I might be able to offer you some help: my LogBuddy package. It gives you a window which shows all messages coming into a window procedure. (You can also show messages selectively; this example just shows everything.) A little more complicated than just firing up a debugger, but not too bad:
include LogBuddy.inc

; Initialize LogBuddy:
CALL LogBuddyInit
INVOKE LogBuddyStart, NULL

; Capture messages inside a window proc:
INVOKE LogBuddyLogMsg, hWin, uMsg, wParam, lParam, $LB_msgsAll

; Put this at the end of your program:
include LogBuddyStub.asm

Everything included in .zip, including a manual(!). Make sure to put the dll (LogBuddy.dll) where it can be found (folder with code being debugged will work).
Assembly language programming should be fun. That's why I do it.

sinsi

You could also try WinSpy

One thing I noticed, if you use MessageBox with a NULL window handle it isn't modal to your app and just continuously spews message boxes  :sad:
🍺🍺🍺

jj2007

#11
Quote from: sinsi on February 28, 2024, 02:44:03 PMif you use MessageBox with a NULL window handle it isn't modal to your app and just continuously spews message boxes

;===================================================================================
    .ElseIf uMsg==WM_MOUSEMOVE
            Invoke MessageBox, hWnd, ADDR szMouseMove, Offset szAppName, MB_OK
;===================================================================================

Interesting point, thank you, Sinsi!

Quote from: jj2007 on February 27, 2024, 07:48:34 AMmessage appears frequently without any moves

Here are the messages sent when hitting space to close the MessageBox without moving the mouse:
msg    2624  00000000 0019F5DC WM_WINDOWPOSCHANGING
msg    2631  00000001 00000000 WM_ENABLE
msg    2632  00000000 0019F3AC WM_WINDOWPOSCHANGING
msg    2633  00000001 00931BC2 WM_NCACTIVATE
msg    2634  00000000 0019ECC4 WM_UAHINITMENU
msg    2635  00000000 0019EFDC WM_UAHINITMENU
msg    2636  00000000 0019EFDC WM_UAHDRAWMENU
msg    2637  00000000 0019EF74 WM_UAHDRAWMENUITEM
msg    2638  00000000 0019EF74 WM_UAHDRAWMENUITEM
msg    2639  00000001 00931BC2 WM_ACTIVATE
msg    2640  00000001 C000000F WM_IME_SETCONTEXT
msg    2641  00000002 00000000 WM_IME_NOTIFY
msg    2642  00931BC2 00000000 WM_SETFOCUS
msg    2646  00000000 00000000 WM_CANCELMODE
msg    2647  00000000 00000000 WM_KILLFOCUS
msg    2648  00000000 C000000F WM_IME_SETCONTEXT
msg    2649  00000001 00000000 WM_IME_NOTIFY
msg    2650  00000000 00000000 WM_ENABLE
msg    2651  00000000 00941BC2 WM_NCACTIVATE
msg    2652  00000000 0019EEF4 WM_UAHINITMENU
msg    2653  00000000 0019F20C WM_UAHINITMENU
msg    2654  00000000 0019F20C WM_UAHDRAWMENU
msg    2655  00000000 0019F1A4 WM_UAHDRAWMENUITEM
msg    2656  00000000 0019F1A4 WM_UAHDRAWMENUITEM
msg    2657  00000000 00941BC2 WM_ACTIVATE

And the MessageBox reappears immediately after, although the mouse was definitely not moved :cool:

QuoteWM_MOUSEMOVE can also be generated when a window receives the focus, even though the mouse didn't move. So if you set a breakpoint on OnMessage() and it hits, to immediately continue running then you'll indeed see a mouse move message over and over again. Tough cases requires using the remote debugging feature. –
Hans Passant May 27, 2023

Hans Passant knows his stuff :thumbsup:

dc

thank you... good to know