Delphi传IP到NetMetting

来源:互联网 发布:淘宝商品链接在哪 编辑:程序博客网 时间:2024/05/01 17:20
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    Edit1: TEdit;

    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  h:HWND;
  hCombox:HWND;
  hConnect:HWND;
  function  EnumChildWndProc(AhWnd:LongInt;
  AlParam:lParam):boolean;stdcall;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  h:=FindWindow(nil,'NetMeeting - 通話なし');
  if (h<>0) then
  begin
    EnumChildWindows(h,@EnumChildWndProc,0);
  end;
  //showmessage(inttostr(childh));

  SendMessage(hCombox,WM_SETTEXT,0,Integer(Pchar(edit1.Text)));
  //showmessage(inttostr(hConnect));
  //SendMessage(hCombox,WM_SETFOCUS,0,0);
  //SendMessage(hCombox,WM_KEYDOWN,VK_RETURN,0);

  setForegroundWindow(h);
  keybd_event(vk_return,mapVirtualKey(vk_return,0),0,0);
end;

function  EnumChildWndProc(AhWnd:LongInt;
  AlParam:lParam):boolean;stdcall;
var
  WndClassName: array[0..254] of Char;
  WndCaption: array[0..254] of Char;
begin
  GetClassName(AhWnd,wndClassName,254);
  GetWindowText(aHwnd,WndCaption,254);

  if (Strpas(wndClassName)='ComboBox') then
  begin
    hCombox:=ahwnd;
  end;

  {
  if (strpas(wndClassName)='Button') then
  begin
    hConnect:=aHwnd;
  end;
  }
         {
  with form1.memo1 do
  begin
    lines.add( string(wndClassName));
    lines.add( string(wndCaption));
    lines.add('-------');
  end;
          }
  result:=true;
end;

end.