title: Win32/Qt - Can one Enumerate all the toplevel windows belonging to the calling process?
body: <p>I want to detect all the top-level windows in order to send messages to it's Descendants.
  How can I do that?
  The following code seems to not be detecting Qt top level window, I don't know why.</p>
  
  <pre><code>static BOOL CALLBACK EnumWindowsProc(_In_ HWND hwnd, _In_ LPARAM lParam) {
    WORD far wndProcessID;
  
    WORD currentProcessID = GetCurrentProcessId();
    std::vector&lt;HWND&gt; *topWindowList = (std::vector&lt;HWND&gt; *)lParam;
    if (topWindowList != NULL &amp;&amp;
        GetWindowThreadProcessId(hwnd, NULL) == currentProcessID) {
      printf("Found a top level window");
      fflush(stdout);
      topWindowList-&gt;push_back(hwnd);
    }
    return TRUE;
  }
  
  void enumAllDesktopChildWindow() {
    std::vector&lt;HWND&gt; topWindowList;
    EnumChildWindows(GetDesktopWindow(), EnumWindowsProc, LPARAM(&amp;topWindowList));
  }
  </code></pre>