Visual C++ and MFC Fundamentals Chapter 15: Fundamental Controls
{
BOOL bResult = CPropertySheet::OnInitDialog();
// TODO: Add your specialized code here
// Change the caption of the OK button
CButton *btnOK;
btnOK = reinterpret_cast<CButton *>(GetDlgItem(IDOK));
btnOK->SetWindowText("Sumbit");
// Hide the Apply button
CButton *btnApply;
btnApply = reinterpret_cast<CButton *>(GetDlgItem(ID_APPLY_NOW));
btnApply->ShowWindow(FALSE);
// Destroy the Help button
CButton *btnHelp;
btnHelp = reinterpret_cast<CButton *>(GetDlgItem(IDHELP));
btnHelp->DestroyWindow();
return bResult;
}
To add a button, declare a pointer to CButton and call its Create() method to initialize.
We have seen various examples of how to dynamically create a control. If you decide to
dynamically create a button, some of the issues you would have to deal with here are the
location and probably the size of the new button, which have little to do with
programming but with geometry. Here is an example:
BOOL CGeomeSheet::OnInitDialog()
{
BOOL bResult = CPropertySheet::OnInitDialog();