有关给TWebBrower打开的Html赋值的问题?

kxy 2001-05-11 12:58:00
html
<form method="post" action="" enctype="multipart/form-data">
<input type="file" name="ANS2">
</form>


procedure TForm1.Button1Click(Sender: TObject);
begin
wb1.Navigate('c:\test.html');
end;

procedure TForm1.Button2Click(Sender: TObject);
var
WebDoc : IHTMLDocument2;
pDispatch : IDISPATCH;
FormCollection : IHTMLElementCollection;
FormElement : IHTMLFormElement;
FormItem : IHTMLElement;
InputFileElement : IHTMLInputFileElement;
I,J : integer;
begin
//
OleCheck(wb1.Document.QueryInterface(IID_IHTMLDocument2,WebDoc));
FormCollection := WebDoc.Get_forms;
// Get a pointer to the first form in the collection of forms
for j:=0 to FormCollection.length-1 do
begin
pDispatch := FormCollection.item(j, 0);
// Make sure it supports the correct interface
OleCheck(pDispatch.QueryInterface(IID_IHTMLFormElement, FormElement));

// Get a pointer the desired element of the form
for i:=0 to FormElement.length-1 do
begin
pDispatch := FormElement.item(i, 0);
// Make sure it supports the required interface
OleCheck(pDispatch.QueryInterface(IID_IHTMLElement, FormItem));
if FormItem.QueryInterface(IHTMLInputFileElementDisp, InputFileElement) = 0 then
begin
InputFileElement.value := 'c:\123.txt';
end
end;
end;
end;
但是InputElement中没有值
...全文
57 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
TechnoFantasy 2001-05-11
  • 打赏
  • 举报
回复
对于IHTMLInputFileElement。value属性是只读的。
kxy 2001-05-11
  • 打赏
  • 举报
回复
??
kxy 2001-05-11
  • 打赏
  • 举报
回复
?

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧