TLama

Untitled

Nov 28th, 2013
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.48 KB | None | 0 0
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3.   WndHandle: HWND;
  4.   TextValue: string;
  5.   TextLenght: Integer;
  6. begin
  7.   WndHandle := FindWindowHandleByTitle('Notepad');
  8.   TextLenght := SendMessage(WndHandle, WM_GETTEXTLENGTH, 0, 0);
  9.   if TextLenght > 0 then
  10.   begin
  11.     SetLength(TextValue, TextLenght);
  12.     TextLenght := SendMessage(WndHandle, WM_GETTEXT, TextLenght + 1, LPARAM(PChar(TextValue)));
  13.     SetLength(TextValue, TextLenght);
  14.     Memo1.Text := TextValue;
  15.   end;
  16. end;
Advertisement
Add Comment
Please, Sign In to add comment