- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
在 VC++ 中,我使用 EnumWindows(...)、GetWindow(...) 和 GetWindowLong() 来获取窗口列表并检查窗口是否是顶部窗口(没有其他窗口作为所有者),并且窗口是否可见(WS_VISIBLE)。然而,虽然我的桌面只显示了 5 个窗口,但这个 EnumWindows 却给了我 50 个窗口,真有趣!任何 Windows 极客请帮助我澄清...
最佳答案
Raymond 在 MSDN 博客上的这篇文章中描述了在任务栏中(或类似地在 Alt-Tab 框中)仅列出窗口的方法:
Which windows appear in the Alt+Tab list?
这是检查窗口是否显示在 alt-tab 中的 super 功能:
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;
}
关于c++ - 为什么 EnumWindows 返回的窗口比我预期的要多?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7277366/
我有一个非常基本的问题:EnumWindows 线程安全吗? http://msdn.microsoft.com/en-us/library/windows/desktop/ms633497(v=vs
我有一个非常基本的问题:EnumWindows 线程安全吗? http://msdn.microsoft.com/en-us/library/windows/desktop/ms633497(v=vs
我在尝试 EnumWindows 到类中的函数时遇到了一个奇怪的错误。这是我的代码 EnumWindows(&ConsoleDetector::EnumWindowsProc, NULL); BOOL
我正在创建一个 dll 文件。 我的代码: BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam); void test() { Enu
我正在尝试创建一个功能类似于任务管理器以及许多其他功能的程序。目前,我无法使用当前的枚举函数找到所有顶级窗口。出于某种原因,它会正确枚举并填写某些应用程序的 HWND(例如 Google Chrome
从几个初步测试看来 EnumWindows总是以相反的实例化顺序返回窗口,即最近实例化的窗口最先。这是一个有效的观察吗?如果是这样,是否适用于所有版本的 Windows?这是一个可靠的假设吗,即该行为
在 Win7 64 位上使用 Delphi XE2 update 3 或 update 4。 调用 enumwindows 的工作方式与以前在 Delphi 6 中的工作方式不同。 在 Delphi
我在使用嵌套类中的回调函数的 EnumWindows 函数时遇到一些问题: TProcessWatch = class(TObject) private ... type TProce
我只是想枚举系统中的所有顶级窗口。当我在 exe 中使用 EnumWindows 函数时,它会枚举所有窗口。相反,我在服务中使用了我不能使用的服务。它只枚举 C:\Windows\System32\s
我需要打电话吗 CloseHandle()在 EnumWindows() 返回的句柄上? 最佳答案 您只能在 kernel32 中的函数返回的句柄上使用 CloseHandle()。它们是引用计数的,
这个问题在这里已经有了答案: how to pass a non static-member function as a callback? (8 个答案) 关闭 8 年前。 我可以使用成员函数作为
如何知道 EnumWindows 何时完成其窗口列表?因为 EnumWindows 接收一个回调函数作为参数,它会一直调用它,直到没有更多的窗口被列出。 最佳答案 EnumWindows() 在进行枚
我假设,我问的实际上应该是默认的,但我遇到了一些我不理解的行为。 #include "stdafx.h" using namespace std; BOOL CALLBACK enumWindowsP
在 VC++ 中,我使用 EnumWindows(...)、GetWindow(...) 和 GetWindowLong() 来获取窗口列表并检查窗口是否是顶部窗口(没有其他窗口作为所有者),并且窗口
C# 的 GetForegroundWindow() 为多个窗口返回相同的结果,EnumWindows 根本不返回那个窗口。每个进程实际上都有自己的层。 我还检查了两个 GetWindowThread
我刚刚开始使用 pywin32,所以我对它应该如何工作有点粗略,但是当我从回调中返回 False 时 win32gui.EnumWindows 不喜欢它,我不是确定为什么。例如,以下崩溃 from w
我目前正在构建在某些硬件设备上执行一些无人值守的自动化测试的应用程序。它执行一堆 .msi 安装程序,然后对它们执行测试。 这里是执行环境:- Windows 7 标准嵌入式- UAC 打开 - HK
代码一直有效。我设法让 Visual C++ Express 没有在最终返回语句中遇到断点,它似乎永远运行。 在下面的示例代码中,EnumWindows 无限枚举。枚举完所有窗口后,如何让它停止。 #
我有一个应用程序可以列出当前 session 打开的窗口。它使用 user32.dll 中的 EnumWindows 方法。 我想从 Windows 服务运行此代码,但由于该服务未附加到用户 sess
使用这段代码: internal static List EnumerateWindows() { var shellWindow = GetShellWindow(); var wi
我是一名优秀的程序员,十分优秀!