从HWND获取窗口信息
Getting Window info from its HWND
我有这样的代码:
HWND WindowHandle;
WindowHandle = FindWindowA( WindowClass, WindowName );
if( WindowHandle != NULL)
{
// here I want to populate a listbox with the window's information like
// its process name and PID, executable file name, and its window title.
}
我已经知道如何获得窗口标题,与SendMessage();
和WM_GETTEXT
,但我想知道如何获得它的进程名和PID,以及可执行文件的位置和名称。
有人能帮我吗?
请注意,我正在使用c++ MFC。
Windows提供了一个名为GetWindowThreadProcessId
的函数。
听起来像是你想要的。
免责声明:我没有用过
您可以在PROCESS_INFORMATION
中找到PID。只需声明:PROCESS_INFORMATION pi
,并像这样访问PID: pi.hProcesss
pi.dwProcessId
。
相关文章:
- 正在查找文档以获得PS4平台的C++中的设备信息
- 如何在Qt窗口小部件中使用QStringView(或QStringRef)
- 为什么在运行时没有向我们提供有关分段错误的更多信息?
- 问:如何使用C++中的按钮从窗口打开窗口
- 奇怪的(对我来说)返回声明 - 在谷歌上找不到任何关于它的信息
- SDL 窗口不会弹出
- 在createdialog创建的窗口中捕获用于编辑控件的OnMouseMove消息
- 如何使用 c++ 在窗口中获取系统信息
- C++输出信息到新窗口
- 如何使用在窗口中使用C++从CreateToolhelp32Snapshot获取64/32位进程详细信息和进程信息
- 单击按钮后,如何在QT中更改窗口中的信息
- 用c++将信息写入空窗口
- 如何显示来自窗口应用商店应用的信息
- 有没有办法在wxWidgets 2.8+中保存窗口大小信息
- 设置控制台信息窗口大小调整不起作用 c++
- 我怎么能返回信息后,我的主窗口在Qt关闭
- 创建一个简单的窗口来输出用于调试的信息(日志样式)- wxWidgets
- Visual Studio-如何将调试信息输出到调试窗口
- 在多个监视器上设置控制台窗口信息
- 从HWND获取窗口信息