|
-
October 19th, 1999, 02:52 AM
#1
Disable all controls in a dialog box.
Hi,
I want to disable all the controls in dialog box. I can manually disable by taking the ID of every controls.
But I do not want to do like this. How can i get the handle of first dialog box control. Then in a loop
I will disable the the controls.
Please Help.
Regards,
Pabitra
-
October 19th, 1999, 02:54 AM
#2
Re: Disable all controls in a dialog box.
Hi Pabitra,
this is how I did it in a class derived from CPropertyPage.void PropertyPage::EnableAllControls( BOOL bEnable /* = TRUE */ )
{
CWnd* pwndChild = GetWindow( GW_CHILD );
while ( pwndChild )
{
pwndChild->EnableWindow( bEnable );
pwndChild = pwndChild->GetNextWindow( GW_HWNDNEXT );
}
}
Works the same way in a CDialog derived class.
Martin
-
October 19th, 1999, 05:54 AM
#3
Re: Disable all controls in a dialog box.
This is the code for a specific dialog box.
Can I have a common code which works for
every dialog box.
Regards,
pabitra
-
October 19th, 1999, 05:56 AM
#4
Re: Disable all controls in a dialog box.
Hi,
that's easy. Derive a class from CDialog, for instance CMyDialog, add the function, and use it where you would normally use CDialog.
That's how we did it in our project. We don't derive from CPropertyPage, but from our PropertyPage.
Martin
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
|