CWnd* pWnd = GetTopWindow(); while(pWnd!=NULL) { int i = pWnd->GetDlgCtrlID(); CString str; str.Format("ID是:%d", i); //pWnd->SetWindowText(str); if(i!=-1) MessageBox(str); pWnd = pWnd->GetNextWindow(); }
转载于:https://www.cnblogs.com/pythonschool/archive/2012/11/13/2768434.html