title: How to stop EnumWindows running infinitely win32
body: <p>The code worked all along. Somehow I manage to get Visual C++ Express not hit the break point on the final return statement and it appeared to run for ever.</p>
  
  <p>In the example code bellow EnumWindows enumerates infinitely.
  How can one make it stop after all windows has been enumerated.</p>
  
  <pre><code>#include &lt;Windows.h&gt;
  
  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;
  }
  </code></pre>