哪位知道帮帮忙哈、、、、、
解决方案 »
- 求助学习delphi的经典资料
- delphi 如何在日文系统显示正常?
- 帮帮我,急...
- 通过剪贴版与Windows资源管理器互拷文件
- 菜鸟求助--如何通过命令按钮打开一个可执行文件!
- Append和Insert的不同(在线等待)
- 有<<十倍速时代>>电子版吗??
- 江湖救济!!!!!!!!!!!!!!!!!!!!!!!!!ADO数据控件如何设置autocommit属性!!!!!!在线等候!!!!!请各位好心的人们婶出援助之手!!!!!!!!!!!!!!!!!!!!
- $200 Wanted it!谁能给个多线程处理数据库的源代码!或请教Delphi多线程同步处理多个存储过程?
- 用cxGrid越界
- Missing Data Provider or Data Packet,欢迎up
- 错在那里
http://expert.csdn.net/Expert/topic/1991/1991829.xml?temp=.9192163
implementation
uses shellapi,SHDocVw,activex;
{$R *.dfm}function WB_GetHTMLCode(WebBrowser: TWebBrowser; ACode: TStrings): Boolean;
var
ps: IPersistStreamInit;
ss: TStringStream;
sa: IStream;
s: string;
begin
result:=false;
ps := WebBrowser.Document as IPersistStreamInit;
s := '';
ss := TStringStream.Create(s);
try
sa := TStreamAdapter.Create(ss, soReference) as IStream;
try
Result := Succeeded(ps.Save(sa, True));
except
end;
if Result then ACode.Add(ss.Datastring);
finally
ss.Free;
end;
end;//WB1.Navigate('http://cn.yahoo.com');
procedure TForm1.Button3Click(Sender: TObject);
begin
if WB_GetHTMLCODE(WB1,memo1.Lines) then ....
end;
var IDisp:IDispatch;
pElement:IHTMLElement;
begin
for I := 0 to Document.all.length - 1 do // Iterate
begin
IDisp:=Document.all.item(i,i);
IDisp.QueryInterface(IID_IHTMLElement,pElement);
if CompareText(pElement.tagName,'HTML')=0 then
begin
Result :=pElement.outerHTML;
exit;
end;
end; // for
end;
function GetHTML(Document:IHTMLDocument2):String;
var i:integer
IDisp:IDispatch;
pElement:IHTMLElement;
begin
for I := 0 to Document.all.length - 1 do // Iterate
begin
IDisp:=Document.all.item(i,i);
IDisp.QueryInterface(IID_IHTMLElement,pElement);
if CompareText(pElement.tagName,'HTML')=0 then
begin
Result :=pElement.outerHTML;
exit;
end;
end; // for
end;