unit MainFormUnit;

interface

uses
  IEHTTP3,Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
  ShDocVw,StdCtrls,
  Forms, Dialogs,
  ActiveX,
  ComObj,
  ShlObj,
  Toolwin,
  ComCtrls, Buttons;

type
  TMyForm = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure Edit1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  MyForm: TMyForm;
  Browser:IInterface;

implementation

{$R *.dfm}

procedure TMyForm.Button1Click(Sender: TObject);
var
//   f : textfile;
   sss : string;
   IE: TIEHTTP;
   POST,Path:OleVariant;
begin
 if edit1.Text<>'' then begin
  IE:=TIEHTTP.Create(nil);
  IE.MultipartPOST:=true;
  IE.RequestMethod:='POST';
  IE.postStr:='enum='+edit1.Text+'&lookup=lookup';
  IE.URL:='http://bgenum.com/lookup.php';
  IE.Execute;
  sss:=IE.sl.Text;
  IE.Free;
{  AssignFile(f,'c:\1.html');
  rewrite(f);
  writeln(f,sss);
  closefile(f);}
  try
    Browser:=CreateComObject(CLASS_InternetExplorer);
  except
    on E:Exception do showmessage(E.Message);
  end;
  if Browser=nil then begin
    ShowMessage('Browser=nil');
    Exit;
  end else begin
    (Browser as IWebBrowser2).Silent:=true;
    (Browser as IWebBrowser2).Visible:=true;
    Path:='http://bgenum.com/lookup.php';
    POST:='enum='+edit1.Text+'&lookup=lookup';
    (Browser as IWebBrowser2).Navigate2(Path,EmptyParam,EmptyParam,POST,EmptyParam);
  end;
 end;
end;

procedure TMyForm.Edit1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
 if (key=13) then begin
  Button1Click(Sender);
 end;
end;

end.
