第一个方法并不需要你删除文件,没看见是rewrite吗?
定义一个回调函数
function EnumChildWindowsProc(hwnd: Integer; lparam: Longint): Boolean; stdcall;
var
buffer: array[0..255] of char;
begin
Result := True;
GetClassName(hwnd,buffer,256);
if StrPas(Buffer)='Edit' then
begin
Result:=False;
SendMessage(hwnd, WM_SETTEXT, 0, Integer(Pchar('kkdfiekdjfd')));
end;
end;
var
H: THandle;
buffer: array[0..255] of char;
begin
winexec('notepad.exe', sw_normal);
H := FindWindow('NotePad', nil);
if H > 0 then
EnumChildWindows(H, @EnumChildWindowsProc,Integer(@buffer[0]));
end;