在操作中显示已打开窗口的列表 [英] Show list of opened windows in op
本文介绍了在操作中显示已打开窗口的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
玩得开心
i使用visual c ++,我想知道如何获得包含名字的列表在操作系统中打开的窗户?
关心我们不知道它们的数量。
例如:
i打开计算器,计算机,个性化,...窗口。
最后我想在下面列出API函数:
计算器
电脑
个性化
。
。
。
hi everybody
have a good time
i use visual c++ and i want to know how can i get a list that includes names of opened windows in Operating system?
Care that we don''t know count of them.
for example:
i open the "Calculator", "Computer", "Personalization", ... windows.
finally i want to give below list with API functions:
Calculator
Computer
Personalization
.
.
.
推荐答案
正如 Richard 已经建议的那样,使用 EnumWindows
功能。然后在回调实现中(参见 EnumWindowsProc回调函数 [ ^ ] ),打电话给 GetWindowText [ ^ ] ,请参阅此主题 [< a href =http://forums.devshed.com/c-programming-42/c-help-with-enumwindows-getwindowtext-needed-please-332249.html\"target =_ blanktitle =New Window> ^ ]。
As Richard already suggested, use EnumWindows
function. Then in the callback implementation (see EnumWindowsProc callback function[^] at MSDN), call GetWindowText[^], see this thread[^].
EnumWindows
功能 [ ^ ]可以得到你想要的东西。
The EnumWindows
function[^] will get you what you want.
这段代码作品:
this code works:
BOOL EnumWindowsProc(HWND hWnd, long lParam)
{
char Buff[255], NameOfClass[255];
GetWindowTextA(hWnd, Buff, 254); // titlul ferestrei
GetClassNameA(hWnd, NameOfClass, 254); // clasa
//adauga in lista:
return TRUE;
}
void CEnumWindowsDlg::OnBnClickedButton1()
{
WNDENUMPROC w;
EnumWindows((WNDENUMPROC)EnumWindowsProc, 0);
}
这篇关于在操作中显示已打开窗口的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文