Does anyone know a better way to test if mouse if over buttons?
Weiyang
You should still get WM_SETCURSOR message, so that might be an option.
Alternatively, catch WM_MOUSEMOVE or WM_SETCURSOR in a derived button
class.
Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
What you need to do is subclass the buttons, and use the WM_MOUSEHOVER message in the
subclass. It would be inappropriate to try to do this in the dialog, although it might be
that the WM_MOUSEHOVER handler might GetParent()->SendMessage(...) a user-defined message
to notify the parent that something interesting is happening. But it is better to just
handle this in the button subclass itself.
class CMyButton : public CButton { ... created by ClassWizard...
LRESULT OnMouseHover(WPARAM, LPARAM);
};
in your message map in your .cpp file for the button subclass
ON_MESSAGE(WM_MOUSEHOVER, OnMouseHover)
LRESULT CMyButton::OnMouseHover(WPARAM wParam, LPARAM lParam)
{
// wParam has the flags
// LOWORD(lParam) is the x-coordinate of the current position
// HIWORD(lParam) is the y-coordinate of the current position
// coordinates are in client coordinate space
... do your hover thing here...
return 0;
}
joe
Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm