var
hMain:HWND;
hChild:HWND;
buffer:array[0..255] of char;
ss:Pchar;
begin
hMain:=FindWindow(nil,'计算器');
hChild:=FindWindowEx(hMain,0,nil,nil);
while hChild>0 do
begin
GetClassName(hChild,buffer,256);
if UpperCase(StrPas(@Buffer))='EDIT' then //子窗体类名为TEdit
begin
ListBox1.Items.Add(StrPas(@Buffer));
//读
GetMem(ss,255);
SendMessage(hChild, WM_GETTEXT, 255, longInt(ss));
showmessage('获得的:'+ss);
FreeMem(ss);
//写
SendMessage(hChild,WM_SETTEXT,0,Integer(pchar('23')));
exit ;
end;
hChild:=FindWindowEx(hMain,hChild,nil,nil);
end;
end;