天天看點

mfc 擷取對話框子控件

需要通過代碼擷取對話框上都有哪些控件

CWnd* pChild = GetWindow(GW_CHILD);
while(pChild)
{
    pChild = pChild->GetWindow(GW_HWNDNEXT);
    //篩選特殊類型
    if(pChild && pChild->IsKindOf(RUNTIME_CLASS(CStatic)))
    {
        CString strName;
        pChild->GetWindowsText(strName);
        ...
    }
}