450分请各位富翁一起来讨论一个关于内嵌网页的问题!!!(300分)

  • 主题发起人 好好学习天天向上
  • 开始时间
呵有个办法
不过不是太好
给我发个EMAIL
说明你要什么我给你发过来
我的EMAIL:maochan@x263.net
 
你可以用这个函数来得到HTML内容:

//首先增加 uses ..., NMHTTP ;

function getHtml( urlAddress:string ): String;
var http:TNMHTTP;
begin
try
http := TNMHTTP.Create(nil);
http.TimeOut := 8000;
http.Get(URLaddress);
result := http.Body;
except
result := '';
end;
end;
 
我不会,提前得了。
 
天真:
信已发,请查收,我用的是新浪的邮箱发给你的,不知道有没有问题。

bedlang:
你的方法好像是得到html文件的源码吧?我要的是保存整个页面内容的方法
 
你好已发
 
天真兄:
我怎么还没收到啊.......
 
天真兄,你信里是不是解决方案啊,我收不到你的信,急死我了
 
是呀你的QQ

我在QQ上发给你
 
完全可以达到你的要求,只不过你要自己写代码把WebBrowser里的内容写成一个.mht文件
就象IE的另存为MHT文件效果一样,把网页里的所有内容存成一个以MIME格式编码的文件。
从数据库读出来写成临时文件,再用WebBrowser去Navigate就可以了。
 
xianjun:
用WebBrowser的保存一定会出现对话框,你能否把他去掉?
谢谢
 
如何调用????

unit WSDL;

interface

uses InvokeRegistry, Types, XSBuiltIns;

type

// ************************************************************************ //
// The following types, referred to in the WSDL document are not being represented
// in this file. They are either aliases[@] of other types represented or were referred
// to but never[!] declared in the document. The types from the latter category
// typically map to predefined/known XML or Borland types; however, they could also
// indicate incorrect WSDL documents that failed to declare or import a schema type.
// ************************************************************************ //
// !:string - "http://www.w3.org/2000/10/XMLSchema"


// ************************************************************************ //
// Namespace : http://xmlrad.com/WSFindMP3Bin/WSFindMP3.dll/wsdl
// soapAction: FindMP3
// transport : http://schemas.xmlsoap.org/soap/http
// style : rpc
// binding : WSFindMP3Binding
// service : WSFindMP3Service
// port : WSFindMP3Port
// URL : http://xmlrad.com/WSFindMP3Bin/WSFindMP3.dll
// ************************************************************************ //
WSFindMP3PortType = interface(IInvokable)
['{E457DCF3-304F-29EC-B38A-7A50C0B4EEBD}']
procedure FindMP3(const SearchString: String; const MaxReturn: String); stdcall;
end;

function GetWSFindMP3PortType(UseWSDL: Boolean=System.False; Addr: string=''): WSFindMP3PortType;


implementation
uses SOAPHTTPClient;

function GetWSFindMP3PortType(UseWSDL: Boolean; Addr: string): WSFindMP3PortType;
const
defWSDL = 'http://xmlrad.com/WSFindMP3Bin/WSFindMP3.dll/WSDL';
defURL = 'http://xmlrad.com/WSFindMP3Bin/WSFindMP3.dll';
defSvc = 'WSFindMP3Service';
defPrt = 'WSFindMP3Port';
var
RIO: THTTPRIO;
begin
Result := nil;
if (Addr = '') then
begin
if UseWSDL then
Addr := defWSDL
else
Addr := defURL;
end;
RIO := THTTPRIO.Create(nil);
try
if UseWSDL then
begin
RIO.WSDLLocation := Addr;
RIO.Service := defSvc;
RIO.Port := defPrt;
end else
RIO.URL := Addr;
Result := (RIO as WSFindMP3PortType);
finally
if Result = nil then
RIO.Free;
end;
end;


initialization
InvRegistry.RegisterInterface(TypeInfo(WSFindMP3PortType), 'http://xmlrad.com/WSFindMP3Bin/WSFindMP3.dll/wsdl', '');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(WSFindMP3PortType), 'FindMP3');

end.
 
高手终于现身了!!!赶快学习!!!

天真,我的QQ号是:16900323,你的QQ号是多少?
 
我以前写的,绝对可用,存放HTML原文件在流里面

// »ñµÃBrowserµÄÔ´Âë
function GetWBSource(var Content: String; wb: TWebBrowser): boolean;
var
sl: TStringList;
MemoryStream: TMemoryStream;

function SaveHTMLSourceToStream(var MemoryStream: TMemoryStream; WB: TWebBrowser): boolean;
var
PersistStream: IPersistStreamInit;
Stream: IStream;
begin
result := false;
try
MemoryStream.Clear;
PersistStream := WB.Document as IPersistStreamInit;
Stream := TStreamAdapter.Create(MemoryStream, soReference) as IStream;
if ActiveX.Succeeded(PersistStream.Save(Stream, True)) then Result := true;
MemoryStream.Position := 0;
except
end;
end;

begin
Result := false;
MemoryStream := TMemoryStream.Create();
sl := TStringList.Create();

try
if SaveHTMLSourceToStream(MemoryStream, wb) then
begin
sl.Clear;
sl.LoadFromStream(MemoryStream);
Content := Trim(sl.Text);
Result := true;
end;
finally
MemoryStream.Free();
sl.Free();
end;

end;
 
fucool:你的代码是什么意思啊?解释一下可以吗?谢谢啦

xianjun:能举个例子吗?我对mht格式的文件不熟
 
DragonPC_???:我试试看,先谢过了
 
你不在线上?
 
不过,我那里没有实现图片等相关文件的保存,不过这也是小case,回头我看看保存 mht
有关的API,搞定了贴上来
 
呵我也要!
 
DragonPC_???:
你贴上来的代码是不是要引用其他什么单元,怎么我一运行就报告未定意的标识符?
以下语句中均有未定意的标识符:
(PersistStream: IPersistStreamInit;
Stream: IStream;
PersistStream := WB.Document as IPersistStreamInit;
stream := TStreamAdapter.Create(MemoryStream, soReference) as IStream;
if ActiveX.Succeeded(PersistStream.Save(Stream, True)) then Result := true;
 
天真,我们公司不许用QQ,所以没装,我现在偷偷下一个,你等一会 :)
 
顶部