library Project1;uses
SHDocVw,
mshtml,
Windows;{$R *.res}
var
WebBrowser1: TWebBrowser;function chkUser(id,pwd:string):boolean;stdcall;
var
input1 : IHTMLInputTextElement;
input2 : IHTMLInputTextElement;
Doc : IHTMLDocument2;
frm : IHTMLFormElement;
str,str1 : string;
iTick1:DWORD;
begin
result:=false;
WebBrowser1.Create(nil);
WebBrowser1.Navigate('url');
Doc := IHTMLDocument2(WebBrowser1.Document);
input1 := Doc.all.item('mgid_enc', 0) as IHTMLInputTextElement;
input2 := Doc.all.item('mgpwd_enc', 0) as IHTMLInputTextElement;
frm := Doc.all.item('f',0) as IHTMLFormelement;
input1.value:='a22911';
input2.value:='b22911000';
frm.submit;
iTick1:=GetTickCount();
//while (GetTickCount()-iTick1<=3000) do Application.ProcessMessages;
str:=WebBrowser1.LocationURL;
str1:='suburl';
if pos(str1,str)=-1 then Result:=true;
WebBrowser1.Free;
end;exports
chkUser;
beginend.想实现的效果,在代码WebBrowser1.Navigate('url');执行后,等到WebBrowser1下载完成了再向下执行,行frm.submit;也是,但是不能用sleep,因为用了之后似乎WebBrowser1下载的动作也停了。
在Form里面可以通过
iTick1:=GetTickCount();
while (GetTickCount()-iTick1<=3000) do Application.ProcessMessages;
来实现想要的效果,但是在dll中无法使用 Application.ProcessMessages,在此请假各位。
SHDocVw,
mshtml,
Windows;{$R *.res}
var
WebBrowser1: TWebBrowser;function chkUser(id,pwd:string):boolean;stdcall;
var
input1 : IHTMLInputTextElement;
input2 : IHTMLInputTextElement;
Doc : IHTMLDocument2;
frm : IHTMLFormElement;
str,str1 : string;
iTick1:DWORD;
begin
result:=false;
WebBrowser1.Create(nil);
WebBrowser1.Navigate('url');
Doc := IHTMLDocument2(WebBrowser1.Document);
input1 := Doc.all.item('mgid_enc', 0) as IHTMLInputTextElement;
input2 := Doc.all.item('mgpwd_enc', 0) as IHTMLInputTextElement;
frm := Doc.all.item('f',0) as IHTMLFormelement;
input1.value:='a22911';
input2.value:='b22911000';
frm.submit;
iTick1:=GetTickCount();
//while (GetTickCount()-iTick1<=3000) do Application.ProcessMessages;
str:=WebBrowser1.LocationURL;
str1:='suburl';
if pos(str1,str)=-1 then Result:=true;
WebBrowser1.Free;
end;exports
chkUser;
beginend.想实现的效果,在代码WebBrowser1.Navigate('url');执行后,等到WebBrowser1下载完成了再向下执行,行frm.submit;也是,但是不能用sleep,因为用了之后似乎WebBrowser1下载的动作也停了。
在Form里面可以通过
iTick1:=GetTickCount();
while (GetTickCount()-iTick1<=3000) do Application.ProcessMessages;
来实现想要的效果,但是在dll中无法使用 Application.ProcessMessages,在此请假各位。
解决方案 »
- Delphi 求解决显示比例
- 大家谁会用rzlistview控件啊,我想知道如何动态添加,修改,删除,列表中的项目及子项目,还有他的一些重要属性
- 累加
- 怎样编译.exe成别的文件名
- 新年散分~~~~~~~~~~~~~~~~~~~~~~~~~
- 这段时间DELPHI方面出了好几本书,诸如:Inside VCL(深入核心——VCL架构剖析),DELPHI源码分析等,有的人说是DELPHI回光返照,delphi似乎快
- 有没有个只能选择年月的控件??不要日的!UP有分
- 如何用程序控制ShellListView进入相应的目录???在线等
- 我在远程数据模块中,增加一个带返回值的方法但系统提示funtions of automation interfaces must have a return type of Hresult。
- ADO存取问题
- GDI+ 无规则窗口的问题
- 关于读取文本文件
Application 应该如何传递呢。
测试了一下,不行,我才在触发事件的时候WebBrowser的状态是not busy的