Delphi 国图图书检索

Uses mshtml;//网页相关的接口定义

 

procedure TForm1.Button7Click(Sender: TObject);

var

doc: IHTMLDocument3;

input: IHTMLElement;

btn: IHTMLElement;

begin

try

Fiscomplete := False;

WebBrowser1.Navigate('http://opac.nlc.cn/F');

扫描二维码关注公众号,回复: 58115 查看本文章

while not Fiscomplete do

begin

Application.ProcessMessages;

end;

doc := WebBrowser1.Document as IHTMLDocument3;

input := doc.getElementById('reqterm') as IHTMLElement;

input.innertext := trim(Edit1.Text);

WebBrowser1.oleobject.document.Forms.Item(1, 0).submit;

// btn := doc.getElementsByName('submit') as IHTMLElement;

// if Assigned(btn) then

// begin

// Memo1.Lines.Add('OK');

// end;

except

on e: Exception do

begin

Memo1.Lines.Add(e.Message);

end;

end;

 

procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;

const pDisp: IDispatch; var URL: OleVariant);

begin

if WebBrowser1.ReadyState = 4 then

begin

Fiscomplete := true;

end;

 

end;

猜你喜欢

转载自www.cnblogs.com/jspdelphi/p/8931394.html
今日推荐