News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

TrackMouseEvent

Started by Mr Earl, March 17, 2006, 12:40:45 PM

Previous topic - Next topic

Mr Earl

Why doesn't this code work?

LOCAL track:TRACKMOUSEEVENT

.elseif iMsg==WM_MOUSEHOVER
PrintText"HOVER"

.elseif iMsg==WM_MOUSELEAVE
PrintText"LEAVE"

.elseif iMsg==WM_MOUSEMOVE
mov track.cbSize,sizeof track
mov track.dwFlags,TME_LEAVE or TME_HOVER
m2m track.hwndTrack,hFind
mov track.dwHoverTime,400
invoke TrackMouseEvent,addr track


hFind is a dialog PUSHBUTTON.  I can get a ToolTip to work for it, but I never get a WM_MOUSEHOVER.
DEBUG is turned on

donkey

Make sure that you are not placing the test for the messages in your main window or dialog proc, they have to be in the proc for the control itself. If it is a button then subclass it and use the subclassing procedure...

To sublcass the button (in your WM_INITDIALOG handler or once it is created)
invoke SetWindowLong,hFind,GWL_WNDPROC,offset BtnSubClass
mov pButtonProc,eax


Button subclass procedure
BtnSubClass PROC hwnd:DWORD, iMsg:DWORD, wParam:DWORD, lParam:DWORD
LOCAL track:TRACKMOUSEEVENT

.if iMsg==WM_MOUSEHOVER
PrintText"HOVER"

.elseif iMsg==WM_MOUSELEAVE
PrintText"LEAVE"

.elseif iMsg==WM_MOUSEMOVE
mov track.cbSize,sizeof TRACKMOUSEEVENT
mov track.dwFlags,TME_LEAVE or TME_HOVER
m2m track.hwndTrack,hwnd
mov track.dwHoverTime,400
invoke TrackMouseEvent,addr track

.endif
invoke CallWindowProc,pButtonProc,hwnd,iMsg,wParam,lParam
RET
ENDF
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Mr Earl

Thank you.  That solved the problem.