Solved

change the behavior of a button....

Posted on 1998-11-16
1
192 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 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

739 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