我正在寻找一种以编程方式获取任务栏上每个程序的当前任务栏图标(而不是系统托盘)的方法。
我在MSDN或Google上没有找到太多相关信息,因为所有的结果都与系统托盘有关。
任何建议或指针都将很有帮助。
编辑: 我尝试了Keegan Hernandez的想法,但我认为我可能做错了什么。以下是代码(c ++):
#include <iostream>
#include <vector>
#include <windows.h>
#include <sstream>
using namespace std;
vector<string> xxx;
bool EnumWindowsProc(HWND hwnd,int ll)
{
if(ll=0)
{
//...
if(IsWindowVisible(hwnd)==true){
char tyty[129];
GetWindowText(hwnd,tyty,128);
stringstream lmlm;
lmlm<<tyty;
xxx.push_back(lmlm.str());
return TRUE;
}
}
}
int main()
{
EnumWindows((WNDENUMPROC)EnumWindowsProc,0);
vector<string>::iterator it;
for(it=xxx.begin();it<xxx.end();it++)
{cout<< *it <<endl;}
bool empty;
cin>>empty;
}