The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: Don57 on June 08, 2008, 11:34:25 PM

Title: Mouse Location
Post by: Don57 on June 08, 2008, 11:34:25 PM
How do I get the mouse position in the current window. I am using GetMessage to read the event and WM_LBUTTONDOWN to filter for the mouse click, but I need to know where the mouse is in the window.



I tried the lParam, it worked like a charm. Thanks
Title: Re: Mouse Location
Post by: Jimg on June 09, 2008, 12:19:33 AM
Most all the mouse events get the position in lParam.
you can do something like this-
        mov eax,lParam
        push eax
        and eax,0FFFFh
        cwde
        mov MouseX,eax

        pop eax     ;mov eax,lParam
        sar eax,16  ; signed shift
        mov MouseY,eax
Title: Re: Mouse Location
Post by: jj2007 on June 09, 2008, 08:05:38 AM
Study the ScreenToClient and GetCursorPos calls. You will need them...