代码如下:
// 遍历得到页面中的所有Button控件,依次设定其样式和颜色 CWnd* pWnd = GetWindow(GW_CHILD); char cClassName[255]={0}; while(pWnd) { GetClassName(pWnd->GetSafeHwnd(),cClassName,255);//得到控件的类名,主要有Edit,Button,Static等等 if(strcmp(cClassName,"Button") == 0) //是Button控件 { CXTButton *pBtn = (CXTButton*) pWnd; pBtn->SetXButtonStyle(BS_XT_XPFLAT); pBtn->SetColorFace(BUTTON_BKCOLOR); //按钮背景色 } pWnd = pWnd->GetWindow(GW_HWNDNEXT); }