哪里有详细介绍twebrowser编程的资料,请告知(10分)

  • 主题发起人 主题发起人 mdc
  • 开始时间 开始时间
M

mdc

Unregistered / Unconfirmed
GUEST, unregistred user!
哪里有详细介绍twebrowser编程的资料,如何操作http端口的资料,请告诉我,谢谢
 
好好看看Delphi的帮助和自带的Samples就知道如何使用TWebBrowser
 
主要还是看Delphi的帮助,还有就是MSDN。
 
问题:TWebBrowser的调用(献给论坛中帮助过我的所有朋友) ( 积分:0, 回复:1, 阅读:31 )
分类:OLE/Automation ( 版主:g622, hubdog )
来自:softwind, 时间:2001-12-30 11:56:00, ID:823668 [显示:小字体 | 大字体]
procedure TBrowserForm.HtmlParser(TableName:String;ButtonName: WideString);
var
i: integer;
hr: HResult;
begin
ADOTable.TableName := TableName;
ADOTable.Open;
iDoc := WebBrowser1.Document as IHTMLDocument2 ;
iAll := iDoc.Get_all as IHTMLElementCollection;
iDisp := iAll.tags('INPUT');
iDisp.QueryInterface(IHTMLElementCollection, iElements);
iSelectDisp := iAll.tags('SELECT');
hr := iSelectDisp.QueryInterface(IHTMLElementCollection, iSelects);

if hr = S_OK then
begin
for i := 0 to iSelects.length - 1 do
begin
iSelect := iSelects.item(i, varEmpty) as IHTMLSelectElement;
SetSelectValue(iSelect,ADOTable);
end;
end;

for i := 0 to iElements.length - 1 do
begin
iInput := iElements.item(i, varEmpty) as IHTMLInputElement;
SetInputValue(iInput, ADOTable);
end;

for i := 0 to iElements.length - 1 do
begin
iInput := iElements.item(i, varEmpty) as IHTMLInputElement;
if Lowercase(iInput.type_) = 'button' then
begin
if iInput.name = Variant(ButtonName) then
begin
iBtn := iInput as iHTMLElement;
iBtn.Click;
break;
end;
end;

if Lowercase(iInput.type_) = 'submit'then
begin
if iInput.name = Variant(ButtonName) then
begin
iBtn := iInput as iHTMLElement;
iBtn.Click;
break;
end;
end;
end;
end;

procedure TBrowserForm.SetInputValue(iInput :IHTMLInputElement; Table: TADOTable);
var
I: Integer;
begin
if Lowercase(iInput.type_) = 'text' then
begin
for I := 0 to Table.FieldCount - 1 do // Iterate
begin
if iInput.Name = Table.Fields.Fields.FieldName then
iInput.Value := Table.Fields.Fields.AsString;
end;
end; // for
if ( (Lowercase(iInput.type_) = 'radio') or (Lowercase(iInput.type_) = 'checkbox')) then
begin
for I := 0 to Table.FieldCount - 1 do // Iterate
begin
if iInput.Name = Table.Fields.Fields.FieldName then
iInput.Value := Table.Fields.Fields.AsString;
end;
end; // for
end;
{---------------------------------------------------------------------------
设置Select的值
---------------------------------------------------------------------------}
procedure TBrowserForm.SetSelectValue(iSelect: IHTMLSelectElement; Table: TADOTable);
var
i: Integer;

begin
if Lowercase(iSelect.type_) = 'select-one' then
begin
for I := 0 to Table.FieldCount - 1 do // Iterate
begin
if iSelect.name = Table.Fields.Fields.FieldName then
iSelect.value := Table.Fields.Fields.AsString;
end;
end;

end;


 
多人接受答案了。
 
后退
顶部