表示禁用一个按钮,比如你想让一个确定按钮不可用
例竖竖如:在对话框中
BOOL CCMyEditDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu 厅启!= NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's 余伏大main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
// m_p.SetWindowText("sdsds");
GetDlgItem(IDOK)->EnableWindow(FALSE);//让一个控件不可用
return TRUE; // return TRUE unless you set the focus to a control
}
其中:::GetDlgItem(IDOK)->EnableWindow(FALSE);//让一个控件不可用 IDOK是确定按钮ID
效果如图