I want to catch event when mouse cursor is over button on my dialog, and when that happens
to change button text. Should I subclass button or there is some parent notification
message for this or....?
Posted on 2003-08-10 17:52:28 by Mikky
In a normal window I'd just look at WM_MOUSEMOVE and check if it's within the boundaries of the Button. If so, I'd rename the Button.

For a Dialog tho I'm not so sure about it as controls can get bigger and/or smaller depending on what computer the program is on. Maybe something like getting the handle of the Button, do a GetWindowRect on it, Convert this rect to client coordinates using ScreenToClient, grab the WM_MOUSEMOVE and then if it's inside that rect rename it.
Posted on 2003-08-10 19:10:55 by JimmyClif
I used TrackMouseEvent for that once, when the mouse moves over the button it will send mouse move messages to it (subclassed), you can take the opportunity to do a TrackMouseEvent and know as soon as it leaves. I used to have the code somewhere, I look around and if you haven't found anything practical by the time I find it I'll post. The advantage to TrackMouseEvent is you can also track hover times.
Posted on 2003-08-10 20:23:41 by donkey
Here is a bit of code I have to do just that
Posted on 2003-08-10 20:35:56 by Betrayed
Geesh... I'm complicated.. :grin: Guess one can see I never toy too much with dialogs ;)
Posted on 2003-08-10 21:18:32 by JimmyClif
I knew I left it around here somewhere ...

Posted on 2003-08-11 02:56:12 by donkey
Thanks donkey, Betrayed and the rest of you guys.
I am gona check out your suggestions now
Posted on 2003-08-11 19:22:59 by Mikky