procedure TForm1.Timer1Timer(Sender: TObject);<br>var<br> cursorpoint:TagPOINT;<br> windowhandle:hwnd;<br> textmaxlength:integer;<br> textcontent:array[0..100] of char;<br> returnlength:word;<br>begin<br> textmaxlength:=100;<br> Memo2.lines.clear;<br> if GetCursorPos(cursorpoint) then<br> begin<br> Memo2.Lines.Add(format('光标位置x=%d,y=%d',[cursorpoint.x,cursorpoint.y]));<br> windowhandle:=windowfrompoint(cursorpoint);<br> if windowhandle<>null then<br> Memo2.Lines.Add(format('光标处窗口名柄号为%d',[windowhandle]));<br> if iswindow(windowhandle) then<br> returnlength:=SendMessage(windowhandle,WM_GETTEXT,textmaxlength,lparam(@textcontent));<br> if returnlength>0 then<br> begin<br> Memo2.Lines.Add('读到窗口标题为:');<br> Memo2.Lines.Add(textcontent);<br> end;<br> end;<br><br>end;