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

change the behavior of a button....

Posted on 1998-11-16
1
181 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
1 Comment
 
LVL 2

Accepted Solution

by:
wyy_cq earned 50 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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
Different colored text in ComboBox without Subclassing 8 66
Doc'in system (example?) BA 7 115
sum13 challenge 24 122
x-bar in Google Sheets 2 70
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

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