监视IE窗口内容
简单的WIN-API练习,因为不懂C++和MFC,所以就用C了。。不知道是不是应该发表为普通帖子程序代码:
#include <windows.h> #include <stdio.h> #include <string.h> HWND handle; char buff[256]; char *string = "Zaroty"; //红色部分为识别的关键字 void main() { handle = FindWindow("IEFrame",NULL); GetWindowText(handle,buff,255); printf("%s\n",buff); char *a = strpbrk(buff,string); printf("%s\n",a-1); if (!strcmp(--a,buff)) { printf("OK!\n"); } else { PostMessage(handle,WM_CLOSE,NULL,NULL); } }