Advertisement
Advertisement
| 07.05.2008 at 05:56AM PDT, ID: 23540587 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: |
function FillFormField(Browser:TWebBrowser; FieldName, FieldValue: String): Boolean;
var WebDoc : IHTMLDocument2;
pDispatch : IDISPATCH;
FormCollection : IHTMLElementCollection;
FormElement : IHTMLFormElement;
FormItem : IHTMLElement;
InputElement : IHTMLInputElement;
begin
Result:=FALSE;
OleCheck(Browser.Document.QueryInterface(IID_IHTMLDocument2, WebDoc));
FormCollection := WebDoc.Get_forms;
pDispatch := FormCollection.item(0, 0);
OleCheck(pDispatch.QueryInterface(IID_IHTMLFormElement, FormElement));
pDispatch := FormElement.item(FieldName, 0);
OleCheck(pDispatch.QueryInterface(IID_IHTMLElement, FormItem));
if FormItem.QueryInterface(IID_IHTMLInputElement, InputElement) = 0 then
begin
if InputElement.Get_type_ = 'text' then begin
InputElement.Set_value(FieldValue);
Result:=TRUE;
end;
end;
end;
|