Solved

Catching mouse events from a dialog box child control

Posted on 2004-08-03
1
377 Views
Last Modified: 2013-11-20
Urgent!
I would like to be able to catch a left mouse down ( or similar) events from a child control using a handler in the parent dialog box WITHOUT SUBCLASSING child control. For example, if I have a CMyDialog (derived from CDialog) dialog box with CEdit control on it and the user clicks on the edit control, CMyDialog would receive a notification about this event. The possibility to identify which control sent notification is very important.
0
Comment
Question by:polyanovsky
1 Comment
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 500 total points
ID: 11708499
Override the PreTranslateMessage function and check for the mouse event there.
eg.

BOOL CMyDlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_LBUTTONDOWN)
{
//put your stuff here
long nID = ::GetDlgCtrlID(pMsg->hwnd);//this gives you the ID of the control - eg. IDC_EDIT1
}
}
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Get filename and folder into excel 7 69
while loop over for loop 7 93
countEvens challenge 2 79
isEverywhere  challenge 19 72
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: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

863 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now