I want to get the Text in the opened Notepad Window to use this text for my next functions.
If Notepad is open, (Visible or Hidden), I want to get its Handle using FindWindow
and get the text displayed in its working area using WM_GETTEXT
.
I need a proper function to do this.
I also read about getting text from Another Window.
UPDATE
Now I obtained Handle like this:
procedure CurPageChanged(CurPageID: Integer);
var
ResultCode, Notepad: Integer;
begin
if CurPageID = wpReady then begin
ShellExec('Open', 'Notepad.exe', '', '', SW_HIDE, ewNoWait, ResultCode);
Notepad := FindWindowByWindowName('Untitled - Notepad');
if Notepad <> 0 then begin
ShellExec('Open', 'TaskKill.exe', '/F /IM Notepad.exe', '', SW_HIDE, ewNoWait, ResultCode);
Log('Handle to the Notepad has been allocated. HWND is - ' + IntToStr(Notepad));
end;
end;
end;
And I need to get its text as String.
Please Guide.