Dave's Brain

Browse - Programming Tips - How can I easily disable or enable all controls in a Dialog?

Date: 2009may1
Platform: win32
Language: C/C++
Keywords: children, child

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);

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.