procedure TForm12.Button2Click(Sender: TObject); var mystring: PChar; begin GetMem(mystring, 1024); GetWindowText(Button1.Handle,mystring,100); Label1.Caption := Format('%s:%d', [mystring, strlen(mystring)]); FreeMem(mystring); end;