Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to capture mouse events in a CDocument?

Posted on 2014-10-10
1
Medium Priority
?
176 Views
Last Modified: 2014-10-10
Hello,

I have a class derived from CDocument and need to capture a left mouse double click event. How this can be done?

Thanks in advance!

Erik
0
Comment
Question by:WH
1 Comment
 
LVL 31

Accepted Solution

by:
Zoppo earned 2000 total points
ID: 40372466
Hi whselfinvest,

this usually is not done done in the CDocument-derived class since this doesn't fit to MVC paradigma. The common way is to add a message handler for WM_LBUTTONDBLCLK in the related CView-derived class, there it's possible to access the document (via CView::GetDocument) to execute any actions on it.

A description for how to add such a message handler can be found here: http://msdn.microsoft.com/en-us/library/aa232230%28v=vs.60%29.aspx

Hope that helps,

ZOPPO
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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

972 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