[MFC] Enable/Disable all controls in propertypages
Hello everyone!!
I'd like to enable/disable all controls in some propertypages and I thought for this solution put in a common header included in all propertypages to avoid duplication code and without need to know necessarily which controls there are in each page:
BOOL CALLBACK DisableAllChildren(HWND hwnd,LPARAM) {
EnableWindow(hwnd,FALSE);
return TRUE;
}
void DisableControls(HWND hDlg) {
EnumChildWindows(hDlg,(WNDENUMPROC)DisableAllChildren,0);
}
where to disable, I could call as:
DisableControls( GetDlgItem(IDD_MODULES_PROPPAGE)->GetSafeHwnd() );
but I get this error:
error C3867: 'CCommonHeader::DisableAllChildren': function call missing argument list; use '& CCommonHeader::DisableAllChildren' to create a pointer to member
Reading an article on CodeProject I read also this technique isn't thread-safe if I have multiple threads doing the enumeration...
So how I can get to disable/enable all controls in pages safely?...
Thanks to everyone for the little help!!!
Ciao,
Luigi
Re: [MFC] Enable/Disable all controls in propertypages
EnumChildWindows requires global function in lpEnumFunc parameter. Declare DisableAllChildren function as static.