K
K
kozura2014-08-09 20:52:33
C++ / C#
kozura, 2014-08-09 20:52:33

How to get enumerations of controls when creating or initializing a dialog?

Interested in the CWnd* object for the IDC_STATIC resources of a particular dialog.
In principle, you can use the ON_WM_CTLCOLOR message for CTLCOLOR_STATIC and catch them there when redrawing, but I need to change the property for all IDC_STATIC when initializing the dialog.
How can I do that?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ananiev, 2015-12-20
@SaNNy32

In OnInitDialog(), loop through all the elements, select those that are IDC_STATIC and do what you need with them.

CWnd* pwndChild = GetWindow(GW_CHILD);
while (pwndChild)
{
  if(pWndChild->GetDlgCtrlID() == IDC_STATIC)
        {
            // делаем что надо
        }

  pwndChild = pwndChild->GetNextWindow();
};

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question