如何遍历一个窗体上的控件
2009-11-12 08:22
459 查看
原帖:http://topic.csdn.net/t/20031008/10/2332245.html
msdn:
CWnd::GetWindow
CWnd* GetWindow( UINT nCmd ) const;
Return Value
Returns a pointer to the window requested, or NULL if none.
The returned pointer may be temporary and should not be stored for later use.
Parameters
nCmd
Specifies the relationship between CWnd and the returned window. It can take one of the following values:
GW_CHILD Identifies the CWnd first child window.
GW_HWNDFIRST If CWnd is a child window, returns the first sibling window. Otherwise, it returns the first top-level window in the list.
GW_HWNDLAST If CWnd is a child window, returns the last sibling window. Otherwise, it returns the last top-level window in the list.
GW_HWNDNEXT Returns the next window on the window manager’s list.
GW_HWNDPREV Returns the previous window on the window manager’s list.
GW_OWNER Identifies the CWnd owner.
枚举窗口
BOOL EnumWindows(
WNDENUMPROC lpEnumFunc, // 回调函数的指针
LPARAM lParam // 应用程序定义的值
);
上面的函数中所用的回调函数
BOOL CALLBACK EnumWindowsProc(
HWND hwnd, // 父窗口句柄
LPARAM lParam // 应用程序定义的值
);
枚举子窗口
BOOL EnumChildWindows(
HWND hWndParent, // 父窗口句柄
WNDENUMPROC lpEnumFunc, // 回调函数的指针
LPARAM lParam // 应用程序定义的值
);
上面的函数中用到的回调函数
BOOL CALLBACK EnumChildProc(
HWND hwnd, // 子窗口句柄
LPARAM lParam // 应用程序定义的值
);
具体应用,看一下MSDN吧!
msdn:
CWnd::GetWindow
CWnd* GetWindow( UINT nCmd ) const;
Return Value
Returns a pointer to the window requested, or NULL if none.
The returned pointer may be temporary and should not be stored for later use.
Parameters
nCmd
Specifies the relationship between CWnd and the returned window. It can take one of the following values:
GW_CHILD Identifies the CWnd first child window.
GW_HWNDFIRST If CWnd is a child window, returns the first sibling window. Otherwise, it returns the first top-level window in the list.
GW_HWNDLAST If CWnd is a child window, returns the last sibling window. Otherwise, it returns the last top-level window in the list.
GW_HWNDNEXT Returns the next window on the window manager’s list.
GW_HWNDPREV Returns the previous window on the window manager’s list.
GW_OWNER Identifies the CWnd owner.
枚举窗口
BOOL EnumWindows(
WNDENUMPROC lpEnumFunc, // 回调函数的指针
LPARAM lParam // 应用程序定义的值
);
上面的函数中所用的回调函数
BOOL CALLBACK EnumWindowsProc(
HWND hwnd, // 父窗口句柄
LPARAM lParam // 应用程序定义的值
);
枚举子窗口
BOOL EnumChildWindows(
HWND hWndParent, // 父窗口句柄
WNDENUMPROC lpEnumFunc, // 回调函数的指针
LPARAM lParam // 应用程序定义的值
);
上面的函数中用到的回调函数
BOOL CALLBACK EnumChildProc(
HWND hwnd, // 子窗口句柄
LPARAM lParam // 应用程序定义的值
);
具体应用,看一下MSDN吧!
相关文章推荐
- [Gabriel的专栏] 用C#如何遍历一个窗体中的某一种控件
- 如何遍历一个窗体上的控件
- 用C#如何遍历一个窗体中的某一种控件
- 用C#如何遍历一个窗体中的某一种控件
- 如何遍历一个窗体中的某一种控件 c#实现
- 用C#如何遍历一个窗体中的某一种控件
- 如何遍历一个窗体中的某一种控件 c#实现
- 用C#如何遍历一个窗体中的某一种控件
- C# winform中一个类中如何调用另一个窗体的控件或方法
- Qt 如何把一个按钮控件放在窗体的左上脚
- 再谈如何遍历Asp.net窗体下所有的控件
- 如何模拟一个象窗体一样的控件(标题栏、焦点、拖动、
- C#如何在webBrowser1控件通过TagName,Name查找元素(没有ID时)遍历窗体元素
- 来自MSDN的一个Sample:如何自定义 Windows 窗体 DataGridView 控件中的数据格式设置
- ASP.NET 如何:通过遍历控件集合定位页上的 Web 窗体控件
- 一个usercontrol如何能从这个userctrl的控件如button上向组建所在窗体发出一个事件
- 如何遍历一个程序中的所有控件
- [转载]C#如何在webBrowser1控件通过TagName,Name查找元素(没有ID时)遍历窗体元素
- 如何安全地跨窗体调用Timer控件 从一个窗体调用控制另外一个窗体的控件
- Vb.net遍历一个窗口中的所有某类对象 (窗体中的控件) 的方法