EnumWindows(EnumWindowsProc,0);
BOOL CALLBACK EnumWindowsProc(HWND hwnd,LPARAM lParam)
{
char title[256];
::GetWindowText(hwnd,title,256);
CString str_title;
str_title.Format("%s",title);
if(str_title.Find("Excel")!=-1)
....
}
枚举窗口查找Excel应用
本文介绍了一段C++代码,该代码通过枚举所有顶级窗口并检查其标题来查找运行中的Excel应用程序实例。使用了Windows API函数EnumWindows和GetWindowText。
EnumWindows(EnumWindowsProc,0);
BOOL CALLBACK EnumWindowsProc(HWND hwnd,LPARAM lParam)
{
char title[256];
::GetWindowText(hwnd,title,256);
CString str_title;
str_title.Format("%s",title);
if(str_title.Find("Excel")!=-1)
....
}

被折叠的 条评论
为什么被折叠?