Click here to Skip to main content
11,706,979 members (48,005 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C++ static string VC++
Can anybody tell me, that how to change the static control's caption dynamically on the click event of check box without using the click event message. My requirement is as follows:

When user select the check box caption becomes shows "Weighted" and after deselect caption becomes "Average".

Please help me if anybody know.

My actual problem is when I am click on the check box the text of the static control is changed on that clicked event without using the check box click event message.

Methods which are all defined by all friends is not working on the click event. This method only give me reply as checkbox is selected or not.
Posted 25-Jun-12 18:47pm
Edited 26-Jun-12 22:01pm
ThatsAlok at 26-Jun-12 3:16am
Any particular reason not to use click event?
vaibhavj_navdurga at 26-Jun-12 4:02am
To reduce the memory utilisation.
Wes Aday at 26-Jun-12 14:34pm
To put the question another way, any valid reason not to use the click event?
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

first set SS_NOTIFY style then static control. It will generate WM_COMMAND with STN_CLICKED message which you can process

to get proper view read link[^]
ThatsAlok at 26-Jun-12 3:17am
Agree with your thought, however, what the difference if he handle click event instead of WM_COMMAND ?
Mohibur Rashid at 26-Jun-12 3:46am
this is the click event you are looking for
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Check box will send the message WM_COMMAND. Use function IsDlgButtonChecked for check box and SetWindowText to static control.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 165
1 OriginalGriff 125
2 chainerlt 110
3 ppolymorphe 89
4 Mika Wendelius 70
0 OriginalGriff 9,178
1 Sergey Alexandrovich Kryukov 8,512
2 CPallini 5,189
3 Maciej Los 4,766
4 Mika Wendelius 3,696

Advertise | Privacy | Mobile
Web02 | 2.8.150819.1 | Last Updated 27 Jun 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100