有关给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中没有值