请问如何提取另一个程序中一文本框内输入的内容?(50分)

  • 主题发起人 主题发起人 我是小石头
  • 开始时间 开始时间

我是小石头

Unregistered / Unconfirmed
GUEST, unregistred user!
   
 
转贴:<br>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><br>
 
&nbsp; 没有问题吗?我是提取另一程序(我只知道窗口界面)的文本框内容,<br>如:<br>&nbsp; &nbsp;用户在程序中输入“1234556”,我的程序就能取得这一个字符串!
 
//就是它<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>写一个F10健的hook <br>获得焦点所在的窗口handle(当时是找next按钮)<br>将按钮的enabed激活<br>发送消息<br><br>我破解安装程序的方法<br>}<br>
 
具体怎么作的,能说一下吗?????
 
&nbsp; 我才开始学,能不能给我一个完整的示例?<br>&nbsp; &nbsp; &nbsp; ___我要根据窗口中另一个按纽来触发!
 
后退
顶部