Solved

How to capture mouse events in a CDocument?

Posted on 2014-10-10
1
128 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 30

Accepted Solution

by:
Zoppo earned 500 total points
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

762 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