See the following code.
The MyEnumProc runs only one time with the following code. But if I commented out the IsWindowVisible(wnd);, it runs many times.
Why IsWindowVisible make this happened(run only one time)? I thought IsWindowVisible just a function to check the wnd’s attributes?
codes of test.c:
#include <windows.h>
#include <stdio.h>
BOOL CALLBACK MyEnumProc( HWND wnd, LPARAM lParam )
{
printf("run\n");
IsWindowVisible(wnd);
}
int main( void )
{
EnumDesktopWindows( NULL, MyEnumProc, 0 );
printf("end\n");
return 0;
}
My environment is:
Windows XP SP3.
gcc 3.4.6(mingw)
compiled option is: gcc -o test.exe test.c
I did the compile and run the test.exe in the cmd.exe.
EnumDesktopWindows expects you to return a value from your MyEnumProc:
Read the documentation for more information.