Meir Rivkin
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?
i want my dialog to catch the mouse move event of the list control which is on it.
how to do it?
Use SetCapture/ReleaseCapture functions
GOOD LUCK
GOOD LUCK
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi!
more general way:
install local MOUSE hook in the dialog and translate all message to the dialog procedure.
more general way:
install local MOUSE hook in the dialog and translate all message to the dialog procedure.
ASKER
i defined message and used DefWindowProc in the dialog to catch it.
in the listCtrl i used GetParent()->SednMEssage(W M_THE_MSG, 0x0,0x0) to notify the dialog on Mouse move, is it ok?
in the listCtrl i used GetParent()->SednMEssage(W
It is ok :-)
ASKER
is it better than subclassing?
subclassing of what window?
You use subclassing via MFC classes so I don`t understand your last question.
You use subclassing via MFC classes so I don`t understand your last question.
ASKER
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(CDataExchan ge* 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(CAboutDl g)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange( CDataExcha nge* pDX)
{
CDialog::DoDataExchange(pD X);
//{{AFX_DATA_MAP(CAboutDlg )
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDl g, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
ON_WM_LBUTTONDOWN()
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CAboutDlg::OnMouseMove(UIN T nFlags, CPoint point)
{
MessageBox("Ha Move");
CDialog::OnMouseMove(nFlag s, point);
}
void CAboutDlg::OnLButtonDown(U INT nFlags, CPoint point)
{
MessageBox("Test!");
CDialog::OnLButtonDown(nFl ags, point);
}
{
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(CDataExchan
//}}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(CAboutDl
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(
{
CDialog::DoDataExchange(pD
//{{AFX_DATA_MAP(CAboutDlg
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDl
//{{AFX_MSG_MAP(CAboutDlg)
ON_WM_LBUTTONDOWN()
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CAboutDlg::OnMouseMove(UIN
{
MessageBox("Ha Move");
CDialog::OnMouseMove(nFlag
}
void CAboutDlg::OnLButtonDown(U
{
MessageBox("Test!");
CDialog::OnLButtonDown(nFl
}
ASKER
doesn't answer my question, i asked my mouse on a list control.
dont hurry to propose answers so quickly next time.
dont hurry to propose answers so quickly next time.
ASKER
managed to solve my problem but since joakimf is the first to comment he gets the points.
thank u all.
thank u all.
ASKER
every time the mouse is on the list control area the OnMouseMove of the dialog is not catching the event....