Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

modify resource controls in runtime

Status
Not open for further replies.

zoomby

Programmer
Aug 5, 2002
60
DE
hi!

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.

bye
Chris
 
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.

Hope this helps!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top