September 20th, 2010, 04:28 PM
[RESOLVED] CButton and EnableWindow?
This seems really simple. I want to disable a button. A simple google search tells me that I should be passing false to the button's EnableWindow function.
It's not working, and I'm not sure why.
Now, I included a commented out 'showwindow' line in there which works just fine. It removes the button from the display. It's only there for testing purposes. The icon I put on the button with SetIcon also works just fine. I'm missing something dumb, aren't I?
// Get the 'save' button
CButton* saveButton = (CButton*)pMainFrame->m_toolBar.GetDlgItem(IDC_SAVE_BUTTON);
saveButton->SetIcon(::LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_SAVE_ICON))); // Works
// The save button starts out disabled.
saveButton->EnableWindow(FALSE); // Does not work
// saveButton->ShowWindow(FALSE); // Works
Tags for this Thread
Click Here to Expand Forum to Full Width