Solved

Catching mouse events from a dialog box child control

Posted on 2004-08-03
1
376 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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

772 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

10 Experts available now in Live!

Get 1:1 Help Now