How can I modify a control which is part of a resource in runtime? For example, I create a dialog with a button in the resource editor. Then in runtime I want to change the caption of the button.
You can use a whole load of CWnd and/or other class functions to alter controls at runtime depending on which class the control was derived from.
For example, a CButton is derived from the CWnd class. Therefore, to change the caption of your button at runtime you would use:
m_MyButton.SetWindowText("Hello World"
// where 'm_MyButton' is the name of your button variable
at some point in your code to change the button caption. Because CButton is derived from CWnd, you can use lots of the CWnd functions to alter the button because, in effect, your button is also a CWnd object.
To expand on this, you can alter the size of the button, hide the button, get the button's rectangle, etc. etc.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.