试过了,用键盘事件可以填写用户名,但是支付宝的ActiveX密码框用各种方法似乎都不行。
uses
sndkey32; //该单元见 http://www.delphibbs.com/delphibbs/dispq.asp?lid=1084785
procedure TForm1.Button1Click(Sender: TObject);
begin
WebBrowser1.Navigate('https://www.alipay.com');
Timer1.Interval:=5000;
Timer1.Enabled:=true;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
BrowserHwnd,InputHwnd:Cardinal;
i:Integer;
Str:String;
begin
Timer1.Enabled:=false;
SendKeys('www.delphibbs.com',false,0); //OK
keybd_event(9,0,0,0);
keybd_event(9,0,KEYEVENTF_KEYUP,0); //焦点成功转移到支付宝密码控件
Application.ProcessMessages;
SendKeys('delphibbs',false,0); //没反应
end;
革命尚未成功...