Solved

How to capture mouse events in a CDocument?

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

622 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