Solved

change the behavior of a button....

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now