如题,获取文本输入框的句柄后,要想输入框发送字符,发完后按按钮!窗体句柄已经获得,请问接下来应该怎么做?拜托大家了

解决方案 »

  1.   

    http://www.delphibbs.com/delphibbs/dispq.asp?lid=1143441unit Unit1;
    interface
    uses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      StdCtrls, ExtCtrls;
    type
      TForm1 = class(TForm)
        Memo1: TMemo;
        Label1: TLabel;
        Button1: TButton;
        Label2: TLabel;
        Edit1: TEdit;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    var
      Form1: TForm1;
      EditNo: integer;
      fTextHandle: HWND;
    implementation
    {$R *.DFM}
    function GetEditHandle(hwnd: Integer; lparam: Longint):Boolean; stdcall;
    var
        bufClass: array[0..255] of Char;
        bufstr:array[0..255] of Char;
    begin
        Result := True;
        GetClassName(hwnd,bufClass,256);
        if StrPas(BufClass)='TEdit' then
        begin
            inc(EditNo);
            if EditNo=3 then   //你关心的Edit序号=3
            begin
                    GetWindowText(hwnd,bufstr,100);
                    form1.memo1.lines.add(strpas(bufstr));
                    PInteger(lparam)^ := hwnd;
                    Result:=False;
            end;
        end;
    end;procedure TForm1.Button1Click(Sender: TObject);
    var
      Handle: Integer;
      tmpHandle: Integer;
    begin
        Handle:=0 ; tmpHandle:=0;
        EditNo:=0;
        Handle := FindWindow(nil,'收费窗口');
        if Handle<>0 then
        begin
             EditNo:=0;
             tmpHandle := Handle;
             EnumChildWindows(tmpHandle,@GetEditHandle,Integer(@tmpHandle));
        end;
    end;
    end.
      

  2.   

    用消息吧,我最近也在研究控制其他用delphi程序编写的程序
     给edit发送wm_copydata消息
    然后给button发送点击的消息你可以搜索一下
      

  3.   

    function GetEditHandle(hwnd: Integer; lparam: Longint):Boolean; stdcall;
    var
      bufClass: array[0..255] of Char;
      bufstr:array[0..255] of Char;
    begin
      Result := True;
      GetClassName(hwnd,bufClass,256);
      if StrPas(BufClass)='TEdit' then
      begin
        GetWindowText(hwnd,bufstr,100);
        form1.memo1.lines.add(strpas(bufstr));
        PInteger(lparam)^ := hwnd;
        Result:=False;
      end;
    end;我想请问,上面的获取edit的函数,if StrPas(BufClass)='TEdit' then是什么意思?
    其中的TEdit是要获取的窗口中的输入框的控件类型吗?
      

  4.   

    已经获得了Edit和Button的句柄了,请问应该怎么向Edit中发送 数据,是Integer类型的数据