What function is used to disable a control at runtime?
Answers were Sorted based on User's Feedback
Answer / arvin
// Get a pointer to the control's window.
CWnd *p = GetDlgItem(IDC_NEWCONTROL);
// Disable the control.
p->EnableWindow(FALSE);
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / ganeshkumar
GetDlgItem(IDC_EDIT1)->ShowWindow(SW_DISABLE)
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / sundar
using CCmdUI class object also controls state can be modifed at run time.
| Is This Answer Correct ? | 0 Yes | 0 No |
practiced by me, which is a real time example.
EX:-
BOOL Csample_button_name_changeDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Below Code, To Enable or Disable a button as runtime
CButton *pLogin1 = (CButton*)GetDlgItem(IDCANCEL);
pLogin1->SetWindowTextW(L"Reset");
pLogin1->EnableWindow(FALSE);
return TRUE;
}
Note:- pLogin1->EnableWindow(TRUE); // to enable a Cancel button
| Is This Answer Correct ? | 0 Yes | 0 No |
What is socket?
What is the difference between workrer thread and UI thread
What is document-view architecture ? Give me one real time example for SDI ?
What is a message map, and what is the advantage of a message map over virtual functions?
how to give colour for dialog button or static buuto?any one explain full code ?pls pls
how to repaint when working with horizontal scroll bar
How you create a button dynamically?
What are the special requirements for dialog box resources used in a form view?
In MFC By Using Communication Between Dialog Boxes,How Can We Send Message Of one Dialog Box To Another Dialog.?
3 Answers Financial Technologies,
Why not virtual functions to handle messages?
What is mfc class hierarchy?
What function is used to retrieve the currently selected index in a list box?