Solved

OnMouseMove in dialog

Posted on 2002-06-27
12
687 Views
Last Modified: 2013-11-20
hi all,

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

how to do it?
0
Comment
Question by:sedgwick
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 
LVL 42

Author Comment

by:sedgwick
ID: 7112945
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....
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 7113040
Use SetCapture/ReleaseCapture functions

GOOD LUCK
0
 
LVL 1

Accepted Solution

by:
joakimf earned 50 total points
ID: 7113155
You can also subclass the listctrl and in the CListCtrl derived class will you get the WM_MOUSEMOVE message.

/Joakim
0
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
LVL 12

Expert Comment

by:migel
ID: 7113369
Hi!
more general way:
install local MOUSE hook in the dialog and translate all message to the dialog procedure.
0
 
LVL 42

Author Comment

by:sedgwick
ID: 7115640
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?
0
 
LVL 12

Expert Comment

by:migel
ID: 7116943
It is ok :-)
0
 
LVL 42

Author Comment

by:sedgwick
ID: 7123493
is it better than subclassing?
0
 
LVL 12

Expert Comment

by:migel
ID: 7123922
subclassing of what window?
You use subclassing via MFC classes so I don`t understand your last question.
0
 
LVL 42

Author Comment

by:sedgwick
ID: 7123933
nevermind, thanks anyway
0
 

Expert Comment

by:zhoujohnson
ID: 7133233
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);
}
0
 
LVL 42

Author Comment

by:sedgwick
ID: 7136408
doesn't answer my question, i asked my mouse on a list control.
dont hurry to propose answers so quickly next time.
0
 
LVL 42

Author Comment

by:sedgwick
ID: 7136410
managed to solve my problem but since joakimf is the first to comment he gets the points.

thank u all.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

617 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