16,472
社区成员
发帖
与我相关
我的任务
分享
// notepad.c
#include<windows.h>
#include<stdio.h>
#include<process.h>
BOOL CALLBACK EnumChildProc(HWND wnd, LPARAM lParam)
{
static int i=0;
char WindowName[52]={0};
GetWindowText(wnd,WindowName,sizeof(WindowName));
printf("HWND: %d;name: %s\n",wnd,WindowName);
// if name="替换(&R)" class 按钮
if (i==7)
{
SendMessage(wnd,WM_SETTEXT,0,(LPARAM)"Demo");
return 0;
}
i++;
return 1;
}
int main(int argc, char* argv[])
{
HWND wnd=FindWindowEx(NULL,NULL,NULL,"替换");
if (wnd != NULL)
{
EnumChildWindows(wnd,EnumChildProc,0);
}
system("pause");
return 0;
}