System Delphi

{
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
! Name:
GetTextfunction
! Description: This gets the text from so
! mething..like a text box or something.
! By: Api
!
!This code is copyrighted and has ! limited warranties.Please see http: //w
! ww.Planet - Source - Code.com / vb / scripts / Sho
! wCode.asp?txtCodeId = 1154 &lngWId = 7 !for details.! * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * *
}
function GetText(const sHwnd: hwnd): string;
var
sLen: integer;
sText: string;
begin
sLen := SendMessage(sHwnd, wm_gettextlength, 0, 0);
SetLength(sText, sLen);
SendMessage(sHwnd, wm_gettext, sLen + 1, LongInt(@sText[1]));
//fixed thanks to yura
Result := sText;
end;