通过消息啊, function GetText(Handle:HWND):String; var pBuf:PChar;iLength:integer; begin Result:=''; iLength:=GetWindowTextLength(Handle); if iLength=0 then exit; Inc(iLength); GetMem(pBuf,iLength); GetWindowText(Handle,pBuf,iLength); Result:=String(pBuf); FreeMem(pBuf); end;
function GetText(Handle:HWND):String; ~~~~~~~~~~~我怎么知道handle是多少了?而且程序每次运行都一样嘛?
function GetText(Handle:HWND):String;
var pBuf:PChar;iLength:integer;
begin
Result:='';
iLength:=GetWindowTextLength(Handle);
if iLength=0 then exit;
Inc(iLength);
GetMem(pBuf,iLength);
GetWindowText(Handle,pBuf,iLength);
Result:=String(pBuf);
FreeMem(pBuf);
end;
~~~~~~~~~~~我怎么知道handle是多少了?而且程序每次运行都一样嘛?