Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

change the behavior of a button....

Posted on 1998-11-16
1
Medium Priority
?
195 Views
Last Modified: 2013-11-20
I would like to change the caption of a button everytime I move the mouse cursor on top of a button. Is there a way to do it??????? Many thanks.

0
Comment
Question by:stephenkong
[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 2

Accepted Solution

by:
wyy_cq earned 200 total points
ID: 1324809
add meesage map of OnSetCursor in the parent window.
afx_msg BOOL OnSetCursor( CWnd* pWnd, UINT nHitTest, UINT message );
the pWnd is the window under the point, you can get the ID of the window.
pWnd->GetDlgCtrlID() if it equal to the ID of the button,you call pWnd->SetWindowText("in_text"); to set the caption of the window(button).by this you can know when the mouse move into the range of the botton .

but how can you know the cursor is move out of the range of the button,
you need add a tag ,when the mouse move into ,you set it to be TRUE and you need not to call SetWindow("in_text") again when the tag is TRUE.
if you get the ID is not equal to the ID of the button you need to set the tag to FALSE and set button caption at the same time. at the next time you find your mouse is out of the button you will need not to set the caption again.
0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…

715 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