Posted by WAllison on December 01, 2001: In Reply to: capturing text posted by ace on November 06, 2001: : 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); : //get 300 char space in the memory : Memo1.Text := string(EdText); function EnumWindowsProc(wnd: hwnd; lb: TListBox): Boolean ;StdCall; var lpBuffer: array [0..127] of Char; begin GetWindowText(wnd, lpBuffer, 128); If Strlen(lpBuffer) <> 0 Then lb.Items.AddObject(lpBuffer, TObject( Wnd )); Result := True; end; procedure TMainForm.Button1Click(Sender: TObject); begin ENumWindows(@ENumWindowsProc, longint(listbox1)); end; This might help you - enumerates through all open windows saving the window handle in a TListBox... |