mousemove event

How do I get a CButton object to activate OnMouseMove(UINT nFlags, CPoint point) ?
OnMouseMove is only triggered while moving over the dialog object.  I want to know when the mouse is over a button or other control.
electrickAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chensuCommented:
Derive your own class from CButton and override OnMouseMove. Assoicate the button with your derived class.
0
electrickAuthor Commented:
How?
I understand the reasoning, I just don't know how to do it. I've increased points to 100...please explain

Thanks
0
kishk91Commented:
Hi... this is easy..
listen do you know  how to create new class with the wizard??
(class wizard-> new class) select your class name for the button.
derive it from CButton.

inside the CPP file that belongs to the NEW BUTTON CLASS override the OnMoueMove, i mean go to the wizard
(right click -> class wizard)
youll see there Message Maps.
in the list box from your right search for WM_MOUSEMOVE
double click and create the function.
include the H file of the new class in the H of the window that you want.
create a CLASS member object from the NEW button.
like this

private: //or public what ever you choose:
CMyButton btn;

then in the CPP file put this lines in the OnInitInstance or OnInintDialog //or if you wish to create this button from a command (like other mouse click)
btn.Create("test",WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,CRect(100,100,220,120),this,(UINT)12345);
btn.ShowWindow(SW_SHOW);
thats it... you done...now every CMyButton object youll create have the mouse move.
notice the BS_PUSHBUTTON flag, in msdn youll have radio buttons and radio buttons as well..

if you have some question email me at
kishk91@hotmail.com

regards  and good luck
kishk91
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

abdijCommented:
Hi electrick,

By the time i got the code ready kishk91 had answered it. Any way if you need to complete source code you can mail me at abdij_b@hotmail.com
0
electrickAuthor Commented:
Thanks, that's what I needed.  It seems to work fine.
0
electrickAuthor Commented:
That worked fine, now how do I get a pointer back to the Dialog Class to use it's member variables?
0
abdijCommented:
Hi,

Through the GetParent()function in the derived button class.

Bye.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.