Date: 2009may1
Platform: win32
Language: C/C++
Q. How can I easily disable or enable all controls in a Dialog?
A.
// Helper function
static BOOL CALLBACK GotAChild(HWND hwnd, LPARAM bEnable)
{
EnableWindow(hwnd, bEnable);
return TRUE;
}
void EnableChildren(const HWND hwnd, const BOOL bEnable)
{
EnumChildWindows(hwnd, GotAChild, bEnable);
}
// Example use... from OnClose() of an MFC application:
EnableChildren(GetSafeHwnd(), FALSE);
| What this info useful to you? You can donate to say thanks |
Add a comment
Sign in to add a comment