2
我得到以下错误:为什么在设置IHTMLInputTextElement的值时会出现访问冲突?
Access Violation at address 0050AA07 in module "project1.exe". Read of address 00000000.
我想自动填写TWebBrowser形式。这只是一个表单上的“登录”字段。
这是什么意思?我如何解决它?
procedure TForm1.Button2Click(Sender: TObject);
var
doc: IHTMLDocument2;
frm: IHTMLFormElement;
fld: IHTMLInputTextElement;
begin
doc := webbrowser1.Document as IHTMLDocument2;
frm := doc.forms.item(0, EmptyParam) as IHTMLFormElement;
fld := frm.item('login', EmptyParam) as IHTMLInputTextElement;
fld.value := 'someone';
end;
@David Heffernan - 我添加了代码 – dave123 2011-02-13 12:34:13