#include<windows.h>
#include <string.h>
#include <stdio.h>
BOOL CALLBACK lpEnumFunc(HWND hwnd, LPARAM lParam)
{
char str[100];
char *qqlogin="QQLoginMessageWnd";
::GetWindowText(hwnd,str,sizeof(str));
int s=::GetClassName(hwnd,str,100);
if(strchr(str, *qqlogin)!=0){
printf("QQ Login Window!");
}
return 1;
}
int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // pointer to command line
int nCmdShow // show state of window
)
{
EnumWindows(lpEnumFunc,NULL);
}
#include <string.h>
#include <stdio.h>
BOOL CALLBACK lpEnumFunc(HWND hwnd, LPARAM lParam)
{
char str[100];
char *qqlogin="QQLoginMessageWnd";
::GetWindowText(hwnd,str,sizeof(str));
int s=::GetClassName(hwnd,str,100);
if(strchr(str, *qqlogin)!=0){
printf("QQ Login Window!");
}
return 1;
}
int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // pointer to command line
int nCmdShow // show state of window
)
{
EnumWindows(lpEnumFunc,NULL);
}
本文展示了一个使用C++编写的简单程序,该程序通过枚举Windows窗口来查找并标识QQ登录窗口。利用Windows API函数如EnumWindows, GetWindowText及GetClassName等,此程序能够遍历所有活动窗口并检查其标题和类名。
616

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



