Go Premium for a chance to win a PS4. Enter to Win


Disable all child window controls(ie. grayout)

Posted on 1998-01-25
Medium Priority
Last Modified: 2013-11-20
I need to disable all the child controls in a window (say dialog).

For example, say I have a CMyDialog (derived from CDialog) class having
CComboBox myCombo1; ... myCombo100;
CListBox myListBox1; ... myListBox100;

All these variable number of combo, listbox, edit controls get displayed in the Dialog.

At run time I need to Gray them out (disable) them.

What is the most generic way of doing that? (I know myComboBox->EnableWindow(False) etc.. but it won't work in my case because I donot want to hardcode these variable names in my program to diable them.

I want to know a generic way of sending message to ALL visible child controls of a dialog to diable (& grayout) themself.

Any code sample would be very helpful.

Venkatesan Pillai
Senior Software Engineer, Autodesk Inc
San Rafael, CA 94903

Question by:dvenkat
1 Comment
LVL 23

Accepted Solution

chensu earned 90 total points
ID: 1314764
You can use CWnd::GetNextDlgTabItem() and/or CWnd::GetNextDlgGroupItem() to enumerate all the child controls. Pass NULL as the pWndCtl parameter to get the first control.


Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question