////////////////////////////////////////////////////////////////////////////// // MFC Tip #4 -- Vision X Software -- http://www.visionx.com/mfcpro // Disabling a control at runtime // // This source code is provided for instructional purposes, and is released // to the public domain. No claim of ownership is made. Use it at your own // risk. No warranties are expressed or implied. The resulting program may // not be fully functional. No animals were used to test this code. ////////////////////////////////////////////////////////////////////////////// // Get a pointer to the control's window. CWnd *p = GetDlgItem(IDC_MYCONTROL); // Disable the control. p->EnableWindow(FALSE); // Enable the control. p->EnableWindow(TRUE);