如何使用C ++或vb.net取得窗口当前打开的应用程序? [英] how to get the current opened applications in windows using c++ or vb.net?

查看:275
本文介绍了如何使用C ++或vb.net取得窗口当前打开的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在当前打开的应用程序(那些出现在任务栏),而不是当前运行的进程。

i need the current opened applications(those that appear in the task bar) and NOT the currently running processes.

感谢

推荐答案

您需要枚举所有的顶层窗口(使用的 EnumWindows的功能);你要跳过:

You need to enumerate all the top level windows (with the EnumWindows function); you have to skip:

  • 看不见的窗口(查看 IsWindowVisible 功能或直接检查窗口具有WS_VISIBLE风格);
  • 窗户与扩展样式WS_EX_TOOLWINDOW,除非他们有同样的WS_EX_APPWINDOW扩展样式。
  • the invisible windows (check the return value of the IsWindowVisible function or directly check if the window has the WS_VISIBLE style);
  • the windows with the extended style WS_EX_TOOLWINDOW, unless they have also the WS_EX_APPWINDOW extended style.

所有的人应该是那些在任务栏显示(的这里的全文)。

All the others should be the ones shown in the taskbar (here's the full story).

然后,如果你想获得的进程/线程拥有的每个窗口,你可以使用的 GetWindowThreadProcessId 功能。

Then, if you want to get the process/thread owning each of the window, you can use the GetWindowThreadProcessId function.

这篇关于如何使用C ++或vb.net取得窗口当前打开的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆