Visual C++ Question:
Download Questions PDF

How to change the Properties of a Button at runtime?


Assuming that you have set the button's ID as IDC_BTNSAMPLE in the resource editor :-
We have to use the ModifyStyle Function to do this. The function is defined as follows :-
CButton *pBtnSample = (CButton *)GetDlgItem(IDC_BTNSAMPLE); // Make the button look like a checkbox
pBtnSample->ModifyStyle(0,BS_AUTOCHECKBOX,SWP_FRAMECHANGED); // Remove the checkbox style and make it again normal

Download Visual C++ Interview Questions And Answers PDF

Previous QuestionNext Question
How to change the position of Button at runtime?How to change the Mouse Pointer Over a Button at runtime?