The code worked all the time. Somehow I can get Visual C ++ Express to not hit the breakpoint in the last return expression, and it seems to have worked forever.
In the example below, EnumWindows code enumerates endlessly. How can I stop it after all the windows have been listed.
#include <Windows.h>
BOOL CALLBACK EnumWindowsProc(HWND hWnd, long lParam) {
TCHAR buff[255];
if (IsWindowVisible(hWnd)) {
GetWindowText(hWnd, (LPWSTR) buff, 254);
printf("%S\n", buff);
}
return TRUE;
}
int _tmain(int argc, _TCHAR* argv[]) {
EnumWindows(EnumWindowsProc, 0);
return 0;
}
s5804 source
share