[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

mousemove event

Posted on 1999-12-18
7
Medium Priority
?
327 Views
Last Modified: 2013-11-20
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.
0
Comment
Question by:electrick
7 Comments
 
LVL 23

Expert Comment

by:chensu
ID: 2292786
Derive your own class from CButton and override OnMouseMove. Assoicate the button with your derived class.
0
 

Author Comment

by:electrick
ID: 2292856
How?
I understand the reasoning, I just don't know how to do it. I've increased points to 100...please explain

Thanks
0
 

Accepted Solution

by:
kishk91 earned 300 total points
ID: 2293004
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
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

 
LVL 2

Expert Comment

by:abdij
ID: 2293011
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
 

Author Comment

by:electrick
ID: 2293322
Thanks, that's what I needed.  It seems to work fine.
0
 

Author Comment

by:electrick
ID: 2293608
That worked fine, now how do I get a pointer back to the Dialog Class to use it's member variables?
0
 
LVL 2

Expert Comment

by:abdij
ID: 2294002
Hi,

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

Bye.
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
The video provides a quick and easy steps to migrate MBOX file to well known Outlook PST and Office 365. Besides this, it also supports and migrates more than 20 email clients of MBOX which include AppleMail, Opera, Thunderbird and SeaMonkey effortl…

591 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question