Solved

Catch Button DOWN events

Posted on 1997-05-08
1
485 Views
Last Modified: 2013-11-20
I would like to build a momentary button that activates when pressed
and stops when released.  Sound simple?  However, I can't seem to find
any way to catch the mouse down event within the button.  I've tried
subclassing the button and using the OnChildNotify and this got me
some events but not the button down ones.  Does anybody have an example
on doing this?  I've been all through the MSDN CD-ROM without luck.

Thanks,

Ken West
0
Comment
Question by:Ken_West
1 Comment
 

Accepted Solution

by:
syed_dgreat earned 100 total points
ID: 1301418
Try using this:-

Derive a new class from CButton and provide two handlers:-
OnLButtonDown and OnLButtonUp.

First, whenever you press down the button (OnLButtonDown),
do whatever you want (you said
activates when pressed on it right?).
Then later you would stop whenever OnLButtonUp event is detected, you will stop whatever is activated.
Remember also, subclass this dlgitem in your OnInitDialog.

0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
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.

822 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