遍历控件
CWnd* pWnd = GetWindow(GW_CHILD);
char cClassName[255]={0};
while(pWnd)
{
GetClassName(pWnd->GetSafeHwnd(),cClassName,255);//得到控件的类名,主要有Edit,Button,Static等等
//CDataTimeCtrl 是"SysDateTimePick32"
if(strcmp(cClassName,"Button") == 0) //是Button控件
{
CButton *pBtn = (CButton*) pWnd;
pBtn->SetWindowText(_T("hah"));//(BUTTON_BKCOLOR); //按钮背景色
}
pWnd = pWnd->GetWindow(GW_HWNDNEXT);
}
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/denglei265/archive/2008/03/19/2198286.aspx