|
-
December 9th, 2009, 06:04 AM
#1
[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: isableAllChildren': function call missing argument list; use '& CCommonHeader: isableAllChildren' 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
-
December 9th, 2009, 06:12 AM
#2
Re: [MFC] Enable/Disable all controls in propertypages
EnumChildWindows requires global function in lpEnumFunc parameter. Declare DisableAllChildren function as static.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|