Link to home
Start Free TrialLog in
Avatar of Meir Rivkin
Meir RivkinFlag for Israel

asked on

OnMouseMove in dialog

hi all,

i want my dialog to catch the mouse move event of the list control which is on it.

how to do it?
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

ASKER

its a dialog based application.
every time the mouse is on the list control area the OnMouseMove of the dialog is not catching the event....
Use SetCapture/ReleaseCapture functions

GOOD LUCK
ASKER CERTIFIED SOLUTION
Avatar of joakimf
joakimf

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of migel
migel

Hi!
more general way:
install local MOUSE hook in the dialog and translate all message to the dialog procedure.
i defined message and used DefWindowProc in the dialog to catch it.
in the listCtrl i used GetParent()->SednMEssage(WM_THE_MSG,0x0,0x0) to notify the dialog on Mouse move, is it ok?
It is ok :-)
is it better than subclassing?
subclassing of what window?
You use subclassing via MFC classes so I don`t understand your last question.
nevermind, thanks anyway
class CAboutDlg : public CDialog
{
public:
     CAboutDlg();

// Dialog Data
     //{{AFX_DATA(CAboutDlg)
     enum { IDD = IDD_ABOUTBOX };
     //}}AFX_DATA

     // ClassWizard generated virtual function overrides
     //{{AFX_VIRTUAL(CAboutDlg)
     public:
     protected:
     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
     //}}AFX_VIRTUAL

// Implementation
protected:
     //{{AFX_MSG(CAboutDlg)
     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
     afx_msg void OnMouseMove(UINT nFlags, CPoint point);
     //}}AFX_MSG
     DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
     //{{AFX_DATA_INIT(CAboutDlg)
     //}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
     CDialog::DoDataExchange(pDX);
     //{{AFX_DATA_MAP(CAboutDlg)
     //}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
     //{{AFX_MSG_MAP(CAboutDlg)
     ON_WM_LBUTTONDOWN()
     ON_WM_MOUSEMOVE()
     //}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CAboutDlg::OnMouseMove(UINT nFlags, CPoint point)
{
        MessageBox("Ha Move");    
     CDialog::OnMouseMove(nFlags, point);
}
void CAboutDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
     MessageBox("Test!");
     CDialog::OnLButtonDown(nFlags, point);
}
doesn't answer my question, i asked my mouse on a list control.
dont hurry to propose answers so quickly next time.
managed to solve my problem but since joakimf is the first to comment he gets the points.

thank u all.