获取另外一个窗体里文本框里的文字。(100分)

  • 主题发起人 主题发起人 FlyForLove
  • 开始时间 开始时间
F

FlyForLove

Unregistered / Unconfirmed
GUEST, unregistred user!
怎样在一个程序里把另外一个程序里的一个文本框里的文字调过来?
 
unit MainFrm;<br><br>interface<br><br>uses<br>&nbsp; Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br>&nbsp; StdCtrls, ExtCtrls;<br><br>type<br>&nbsp; TMainForm = class(TForm)<br>&nbsp; &nbsp; HandleEdit: TEdit;<br>&nbsp; &nbsp; TextEdit: TEdit;<br>&nbsp; &nbsp; OnTopCheckBox: TCheckBox;<br>&nbsp; &nbsp; Timer: TTimer;<br>&nbsp; &nbsp; procedure FormCreate(Sender: TObject);<br>&nbsp; &nbsp; procedure TimerTimer(Sender: TObject);<br>&nbsp; &nbsp; procedure OnTopCheckBoxClick(Sender: TObject);<br>&nbsp; private<br>&nbsp; &nbsp; { Private declarations }<br>&nbsp; public<br>&nbsp; &nbsp; { Public declarations }<br>&nbsp; end;<br><br>var<br>&nbsp; MainForm: TMainForm;<br><br>implementation<br><br>{$R *.DFM}<br><br>procedure SetStayOnTop(Form: TForm; Value: Boolean);<br>begin<br>&nbsp; if Value Then<br>&nbsp; &nbsp; SetWindowPos(Form.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE<br>)<br>&nbsp; else<br>&nbsp; &nbsp; SetWindowPos(Form.Handle, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSI<br>ZE);<br>end;<br><br>procedure TMainForm.FormCreate(Sender: TObject);<br>begin<br>&nbsp; SetStayOnTop(Self, True);<br>end;<br><br>procedure TMainForm.TimerTimer(Sender: TObject);<br>var<br>&nbsp; Pos: TPoint;<br>&nbsp; Handle: HWND;<br>&nbsp; Buf: array[0..1024] of Char;<br>begin<br>&nbsp; GetCursorPos(Pos);<br>&nbsp; Handle := WindowFromPoint(Pos);<br>&nbsp; HandleEdit.Text := IntToStr(Handle);<br>&nbsp; SendMessage(Handle, WM_GETTEXT, 1024, Integer(@Buf));<br>&nbsp; TextEdit.Text := Buf;<br>end;<br><br>procedure TMainForm.OnTopCheckBoxClick(Sender: TObject);<br>begin<br>&nbsp; SetStayOnTop(Self, OnTopCheckBox.Checked);<br>end;<br><br>end.<br>
 
这个程序只能拷贝可编辑的文本框的文字对于不可编辑的,比如说qq对话模式<br>上面的接受框的就不能拷贝过来,有没有办法呢?<br>
 
后退
顶部