Solved

How to capture mouse events in a CDocument?

Posted on 2014-10-10
1
153 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
[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 31

Accepted Solution

by:
Zoppo earned 500 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

Independent Software Vendors: 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

Title # Comments Views Activity
GUI: DIalog Stacking and Popping in MS C++ 4 98
Safe conversion? 4 87
Autosar OS Multicore Share Resources confusion ? 2 205
using interface in TLB 3 31
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. 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.

751 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