var
FPos: TPoint;
FHandle: THandle;
FTextLen: Integer;
FCaption: String;
sRect: TRect;
begin
//获得当前鼠标坐标
GetCursorPos(FPos);
FHandle := WindowFromPoint(FPos);
//获得窗口坐标
GetWindowRect(FHandle,sRect);
//获得文本
FTextLen := SendMessage(FHandle, WM_GETTEXTLENGTH, 0, 0);
SetLength(FCaption,FTextLen + 1);
GetWindowText(FHandle,PChar(FCaption),FTextLen + 1);
Memo1.Text := Copy(FCaption,1,FTextLen);
end;