• <bdo id='z8AFk'></bdo><ul id='z8AFk'></ul>

    <small id='z8AFk'></small><noframes id='z8AFk'>

  • <legend id='z8AFk'><style id='z8AFk'><dir id='z8AFk'><q id='z8AFk'></q></dir></style></legend>

    <i id='z8AFk'><tr id='z8AFk'><dt id='z8AFk'><q id='z8AFk'><span id='z8AFk'><b id='z8AFk'><form id='z8AFk'><ins id='z8AFk'></ins><ul id='z8AFk'></ul><sub id='z8AFk'></sub></form><legend id='z8AFk'></legend><bdo id='z8AFk'><pre id='z8AFk'><center id='z8AFk'></center></pre></bdo></b><th id='z8AFk'></th></span></q></dt></tr></i><div id='z8AFk'><tfoot id='z8AFk'></tfoot><dl id='z8AFk'><fieldset id='z8AFk'></fieldset></dl></div>

    1. <tfoot id='z8AFk'></tfoot>
      1. 为什么 EnumWindows 返回的窗口比我预期的多?

        时间:2023-10-06
            <tbody id='jUYkZ'></tbody>

          <i id='jUYkZ'><tr id='jUYkZ'><dt id='jUYkZ'><q id='jUYkZ'><span id='jUYkZ'><b id='jUYkZ'><form id='jUYkZ'><ins id='jUYkZ'></ins><ul id='jUYkZ'></ul><sub id='jUYkZ'></sub></form><legend id='jUYkZ'></legend><bdo id='jUYkZ'><pre id='jUYkZ'><center id='jUYkZ'></center></pre></bdo></b><th id='jUYkZ'></th></span></q></dt></tr></i><div id='jUYkZ'><tfoot id='jUYkZ'></tfoot><dl id='jUYkZ'><fieldset id='jUYkZ'></fieldset></dl></div>
              <tfoot id='jUYkZ'></tfoot>

                <bdo id='jUYkZ'></bdo><ul id='jUYkZ'></ul>

                <small id='jUYkZ'></small><noframes id='jUYkZ'>

                <legend id='jUYkZ'><style id='jUYkZ'><dir id='jUYkZ'><q id='jUYkZ'></q></dir></style></legend>
                • 本文介绍了为什么 EnumWindows 返回的窗口比我预期的多?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  在 VC++ 中,我使用 EnumWindows(...)、GetWindow(...) 和 GetWindowLong() 来获取窗口列表并检查窗口是否是顶部窗口(没有其他窗口作为所有者),以及窗口是否可见 (WS_VISIBLE).然而,虽然我的桌面只显示了 5 个窗口,但这个 EnumWindows 给了我 50 个窗口,多有趣!任何 Windows 极客请帮我澄清...

                  In VC++, I use EnumWindows(...), GetWindow(...), and GetWindowLong(), to get the list of windows and check whether the window is top window (no other window as owner), and whether the window is visible (WS_VISIBLE). However, although my desktop is showing only 5 windows, this EnumWindows is giving me 50 windows, how funny! Any Windows geek here please help me clarify...

                  推荐答案

                  Raymond 在 MSDN 博客上的这篇文章中描述了在任务栏中(或类似地在 Alt-Tab 框中)列出窗口的方法:

                  The way to list out only windows in taskbar (or similarly in Alt-Tab box) is described by Raymond in this article on MSDN blog:

                  哪些窗口出现在 Alt+Tab 列表中?

                  这是检查窗口是否显示在 alt-tab 中的超级函数:

                  And this is the super function to check whether a window is shown in alt-tab:

                  BOOL IsAltTabWindow(HWND hwnd)
                  {
                      TITLEBARINFO ti;
                      HWND hwndTry, hwndWalk = NULL;
                  
                      if(!IsWindowVisible(hwnd))
                          return FALSE;
                  
                      hwndTry = GetAncestor(hwnd, GA_ROOTOWNER);
                      while(hwndTry != hwndWalk) 
                      {
                          hwndWalk = hwndTry;
                          hwndTry = GetLastActivePopup(hwndWalk);
                          if(IsWindowVisible(hwndTry)) 
                              break;
                      }
                      if(hwndWalk != hwnd)
                          return FALSE;
                  
                      // the following removes some task tray programs and "Program Manager"
                      ti.cbSize = sizeof(ti);
                      GetTitleBarInfo(hwnd, &ti);
                      if(ti.rgstate[0] & STATE_SYSTEM_INVISIBLE)
                          return FALSE;
                  
                      // Tool windows should not be displayed either, these do not appear in the
                      // task bar.
                      if(GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW)
                          return FALSE;
                  
                      return TRUE;
                  }
                  

                  归功于此处的源代码:
                  http://www.dfcd.net/projects/switcher/switcher.c

                  这篇关于为什么 EnumWindows 返回的窗口比我预期的多?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:静态初始化时的访问冲突 下一篇:在 C++ 中转换为 bool 对性能有什么影响?

                  相关文章

                  最新文章

                  <small id='EH6pU'></small><noframes id='EH6pU'>

                • <legend id='EH6pU'><style id='EH6pU'><dir id='EH6pU'><q id='EH6pU'></q></dir></style></legend>

                  • <bdo id='EH6pU'></bdo><ul id='EH6pU'></ul>

                      <tfoot id='EH6pU'></tfoot>
                    1. <i id='EH6pU'><tr id='EH6pU'><dt id='EH6pU'><q id='EH6pU'><span id='EH6pU'><b id='EH6pU'><form id='EH6pU'><ins id='EH6pU'></ins><ul id='EH6pU'></ul><sub id='EH6pU'></sub></form><legend id='EH6pU'></legend><bdo id='EH6pU'><pre id='EH6pU'><center id='EH6pU'></center></pre></bdo></b><th id='EH6pU'></th></span></q></dt></tr></i><div id='EH6pU'><tfoot id='EH6pU'></tfoot><dl id='EH6pU'><fieldset id='EH6pU'></fieldset></dl></div>