capturing textPosted by ace on November 06, 2001 at 19:27:53: ive got this code that captures text from a window that a mouse is over, can someone modify this code so that you can get the text from a specific window, like MSN Instant Messenger procedure TForm1.Timer1Timer(Sender: TObject); var Point : TPoint; //handle of the edit H : LongInt; //the window EdText EdText: pchar; ControlParent,AU: LongInt; begin //Get the current cursor position GetCursorPos(Point); //get the window at that point H := WindowFromPoint(Point); //get 300 char space in the memory Getmem(EdText,300); //GetWindowText(h,classe,300); SendMessage(H, WM_GETTEXT, 300, LongInt(EdText)); //get controls parent Au := h; while ControlParent <> 0 do begin ControlParent := GetParent(AU); if ControlParent = 0 then begin ControlParent := AU; break; end; AU := ControlParent; end; Memo1.Text := string(EdText); //free the reserved memory freemem(EdText); end;
|