转载自csdn: EnumWindows 用来列举屏幕上所有顶层窗口。 MSDN原话: The EnumWindows function enumerates all top-level windows on the screen by passing the handle to each window。 函数形式: BOOL EnumWindows( WNDENUMPROC lpEnumFunc, // callback
转载自csdn:
EnumWindows 用来列举屏幕上所有顶层窗口。
MSDN原话:
The EnumWindows function enumerates all top-level windows on the screen by passing the handle to each window。
函数形式:
BOOL EnumWindows( WNDENUMPROC lpEnumFunc, // callback function LPARAM lParam // application-defined value ); 其中 WNDENUMPROC 是回调函数,回调函数中写自己想做的操作,当调用EnumWindows的 时候,每次遇到一个窗口,系统就调用一次你的WNDENUMPROC ,然后把窗口句柄传给你。 EnumWindows 函数成功则返回非0值; 函数失败则返回0值; EnumWindowsProc 返回0值,同样导致函数EnumWindows 返回0值。 另外,该函数不列举子窗口,除了几种拥有WS_CHILD 风格的系统所属窗口。 MSDN原话: The EnumWindows function does not enumerate child windows,with the exception of a few top-level windows owned by the system that have the WS_CHILD style. 使用举例: 先声明一个EnumWindowsProc ,比如: BOOL CALLBACK EnumWindowsProc_1(HWND hwnd,LPARAM lparam) ; 然后实现此函数,写入自己想做的事情,比如: BOOL CALLBACK EnumWindowsProc_1(HWND hwnd,LPARAM lparam){
Technorati 标签: C++,