Edit Handle of Notepad

I have the handle of edit for notepad, how can I monitor what has been written on notepad. I tried using a DC handle, all I can do is write to notepads edit clipboard.
npatelAsked:
Who is Participating?
 
jecksomConnect With a Mentor Commented:
heh , thanx :)

0
 
MadshiCommented:
You could use a timer that calls WM_GETTEXT. If you don't like that you'll have to write a system wide hook by calling SetWindowsHookEx (must be in a dll). If you want that, please look at "http://www.experts-exchange.com/Q.10096444".

Regards, Madshi.
0
 
jecksomCommented:
Ohhh , i'm late again , don't wanna throw my code in trashcan , so maybe it help :

procedure TForm1.Button1Click(Sender: TObject);
var buf:array [0..256] of char;
wnd:hwnd;
begin
wnd:=findwindow('Notepad',nil);
if wnd=0 then
showmessage('run notepad and type something!')
else
begin
wnd:=getwindow(wnd,GW_CHILD);
while wnd<>0 do
begin
sendmessage(wnd,wm_gettext,256,longint(@buf));
memo1.lines.add(buf);
wnd:=getwindow(wnd,GW_HWNDNEXT);
end;end;end;

Jecksom

0
 
npatelAuthor Commented:
Jecksom,

Your sample code works, I think both Madshi and You have the correct solution to my problem.

I don't know who gets the points on this one?.

 


0
 
MadshiCommented:
Jecksom gave you a little example. So give the points to him...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.