以前帮同学写的比较简单!仅供参考! function EnumWindowsProc(Hwnd:THandle;lParam:LParam):boolean; var WindowCaption:array[0..254] of Char; begin GetWindowText(Hwnd,WindowCaption,255); if StrPas(WindowCaption)='登入游戏' then begin cnt := 0; EnumChildWindows(Hwnd,@EnumChildProc,0); Result := False; Exit; end; Result := True; end;
function EnumChildProc(Hwnd:THandle;lParam:LParam):boolean; var WindowCaption,WindowClass:array[0..254] of Char; begin GetClassName(Hwnd,WindowClass,255); if Pos('EDIT',UpperCase(StrPas(WindowClass))) > 0 then begin Inc(cnt); SendMessage(Hwnd,WM_SETTEXT,0,LongInt(PChar(IntToStr(cnt)))); if Form1.mygettext(Hwnd)='1' then begin//2 SendMessage(Hwnd,WM_SETTEXT,0,LongInt(PChar(Form1.Edit2.Text))); end;//2 if Form1.mygettext(Hwnd)='2' then begin//2 SendMessage(Hwnd,WM_SETTEXT,0,LongInt(PChar(Form1.Edit1.Text))); end;//2 end; Result := True; end;