VC遍历窗体控件的实现
生活随笔
收集整理的这篇文章主要介绍了
VC遍历窗体控件的实现
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
遍历窗体所有控件代码如下:
CWnd* pwndChild = GetWindow(GW_CHILD);while (pwndChild)
{
//....to do something
pwndChild = pwndChild->GetNextWindow();
}
如果只想得到某一类 ,比如button的。代码如下:
// 遍历得到页面中的所有Button控件,依次设定其样式和颜色CWnd* pWnd = GetWindow(GW_CHILD);
char cClassName[255]={0};
while(pWnd)
{
//得到控件的类名,主要有Edit,Button,Static等等
GetClassName(pWnd->GetSafeHwnd(),cClassName,255);
if(strcmp(cClassName,"Button") ==0) //是Button控件
{
CXTButton *pBtn = (CXTButton*) pWnd;
pBtn->SetXButtonStyle(BS_XT_XPFLAT);
pBtn->SetColorFace(BUTTON_BKCOLOR); //按钮背景色
}
pWnd = pWnd->GetWindow(GW_HWNDNEXT);
}
原文地址: http://blog.csdn.net/guanchanghui/article/details/1491715
转载于:https://www.cnblogs.com/likebeta/archive/2011/07/25/2116534.html
总结
以上是生活随笔为你收集整理的VC遍历窗体控件的实现的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: Cvmat IplImage
- 下一篇: vc6工程转成vs2008的一个问题【W