Solved

Catching mouse events from a dialog box child control

Posted on 2004-08-03
1
382 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
[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
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
Suggested Courses

734 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