1、历遍全部子控间
int childid;
HWND childhwnd=::GetWindow(m_hWnd,GW_CHILD);
while(childhwnd)
{
childid = ::GetDlgCtrlID(childhwnd);
/*添加对子控件的操作*/
childhwnd = ::GetWindow(childhwnd,GW_HWNDNEXT);
}
2、部分指定控件
int IDNames[3] = {IDC_TREE1,IDOK,IDCANCEL};/*指定子控件ID*/
for (int i = 0; i< 3; i++)
{
CWnd *pWnd = GetDlgItem(IDNames[i]);
if (pWnd)
{
/*添加对子控件的操作*/
}
}