Если надо заполнить форму, то вот набросал примерчик:
| Код | uses ..., SHDocVw, ActiveX, MSHTML; procedure TForm1.FormCreate(Sender: TObject); begin CoInitialize(nil); end;
procedure TForm1.Button3Click(Sender: TObject); var isw : IShellWindows; wb2 : IWebBrowser2; doc : IHTMLDocument2; col : IHTMLElementCollection; el : IHTMLElement; i : integer; begin
isw := CoShellWindows.Create; wb2 := isw.Item(0) as IWebBrowser2; doc := wb2.Document as IHTMLDocument2;
// заполнение полей ввода col := doc.all.tags('input') as IHTMLElementCollection; for i := 0 to col.length-1 do begin el := col.item(i, 0) as IHTMLElement; if el.getAttribute('type', 0) = 'text' then el.setAttribute('value', 'input: ' + IntToStr(i), 0); end;
// заполнение textarea col := doc.all.tags('textarea') as IHTMLElementCollection; for i := 0 to col.length-1 do begin el := col.item(i, 0) as IHTMLElement; el.setAttribute('value', 'textarea: ' + IntToStr(i), 0); end;
// включение checkbox'ов col := doc.all.tags('input') as IHTMLElementCollection; for i := 0 to col.length-1 do begin el := col.item(i, 0) as IHTMLElement; if el.getAttribute('type', 0) = 'checkbox' then el.setAttribute('checked', 1, 0); end;
end; | В этом примере берётся первый попавшийся IE. В isw.Count содержится количество окон IE, просматривай их всех, и работай только с нужным. Определить то это окно или нет, можно через wb2.HWND...
|