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
Solved

Catch Button DOWN events

Posted on 1997-05-08
1
490 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

Title # Comments Views Activity
Decoding 32 bit binary streams 6 49
bigDiff challenge 17 126
only14 challenge 19 81
how to split multiple lines delimiter : 8 109
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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…
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

860 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