比如得到QQ上的文本框句柄,并写入相应的值

解决方案 »

  1.   

    文本框也是窗口,
    SetWindowsText()
      

  2.   

    SendMessage(vHandle, EM_REPLACESEL, 0, Integer(PChar('Zswang 路过')));
      

  3.   

    project1:
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TFormMain = class(TForm)
        Edit1: TEdit;
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      FormMain: TFormMain;implementation{$R *.dfm}end.//-------------------------project2:
    procedure TForm1.Button1Click(Sender: TObject);
    var
      h,h1:THandle;
    begin
      h:=FindWindow(nil,'FormMain');
      IF h>0 then
      begin
        h1:=FindWindowEx(h,0,nil,'Edit1');
        if h1>0 then
        begin
          SendMessage(h1, EM_REPLACESEL, 0, Integer(PChar('紧跟着 Zswang 路过')));
        end;
      end;
    end;
      

  4.   

    非常感谢各位!!!还有一个问题:我如何在Project1中得到Project2.FormMain.EDIT1的Text.还有Project2.FormMain.Lable1的Caption呢?
      

  5.   

    uses 6樓的代碼後再FindWindow相應的project窗體控件不行嗎?
      

  6.   

    Edit只要知道句柄就可以通过WM_GETTEXT消息获取,但Label非Windows标准控件,得用hook植入到所在进程获取。
    以前专门讨论过:http://topic.csdn.net/t/20060618/13/4828247.html你可以搜索关键字:“Delphi 其他进程 hook 内容”参考链接:Hook其他程序中的StringGrid的内容
      

  7.   

    非常感谢,
    对于TEXT的操作现在没问题
    我也看完了http://topic.csdn.net/t/20060618/13/4828247.html , 以及参考链接:Hook其他程序中的StringGrid的内容 
    有基本上的思路,<Hook其他程序中的StringGrid的内容>但不能下载。能EMAIL给我吗?[email protected]
      

  8.   

    实在不好意思,最
    还有一个问题:我如何在Project1中按下到Project2.FormMain.Button1?
      

  9.   

    11楼 zswang 给俺也发一个,谢谢!!
      

  10.   

    hook技术相当于在该进程执行代码,你只要找到Button1实例即可调用Button1.Click方法。
      

  11.   

    只有这个思路吗,能否控制MOUSE动作
      

  12.   

    -_-!!!控制mouse?模拟鼠标点击吗?
    mouse_event(MOUSEEVENTF_LEFTDOWN, 0,0,0,0);
    mouse_event(MOUSEEVENTF_LEFTUP, 0,0,0,0);控制鼠标位置?
    Mouse.CursorPos := Point(1, 1);事件上如果通过hook直接把onmousemove等事件重新指向....你也4个裤衩了,应该会举一反三吧。
      

  13.   

    邮件没有收到,能否再发至[email protected]================
    非常感谢, 
    对于TEXT的操作现在没问题 
    我也看完了http://topic.csdn.net/t/20060618/13/4828247.html , 以及参考链接:Hook其他程序中的StringGrid的内容  
    有基本上的思路, <Hook其他程序中的StringGrid的内容>但不能下载。能EMAIL给我吗?[email protected]