hi, i want to save a html file from my browser. i have created my own browser and want to save the html file.. i have used ACTIVE X controls to make my own web browser(same as IE).. it should be like that of SAVE AS option of IE.. plzzhelp..
As i saw there is no directly way. You need to go throgh the elements of the webpages and put them into a stringlist and then save it. Thats one way. Look into your project on disk. Is there any *.tlb and/or *.tlh file The look into *.tlh ( type library header ) and look into the interface class defeintions. There is no mehtod or property to retreive the html.
Maybe someone can help help you with a more easy solution. Maybe there is a trick ot there is a helper interface which does what you want. :-)
If you already used shdocvw.dll COM server then a point to start is maybe the IHTMLDocument Interface. Use IWebBrowser2::Document Property to retreive an idispatch output pointer and do a queryinterface to IHTMLDocument2.
MSDN: C++ programs can retrieve the Component Object Model (COM) interfaces < XML:NAMESPACE PREFIX = MSHelp NS = "http://msdn.microsoft.com/mshelp" />IHTMLDocument, IHTMLDocument2, and IHTMLDocument3 by calling QueryInterface on the IDispatch received from this property.
Use body property, get body interface and then use: innerHTML Sets or retrieves the HTML between the start and end tags of the object. innerText Sets or retrieves the text between the start and end tags of the object.
Your browser component. This is normal coz HTTP is session less protocol. Every time something changes and you want to save a browser makes a request also for every element in a web page.
function SaveDocToFile(Doc: IDispatch; const Fname: string): HResult; var PFile: IPersistFile; begin PFile := Doc as IPersistFile; Result := PFile.Save(StringToOleStr(FName), False); end;
1. Get document interface pointer from your ActiveX control via document property. Look in definition file for that. 2. Make a cast to IPersistFile 3. Call Save method and you are done.
IHTMLDocument implements IPersistFile which is a general interface for loading and saving.
how to save html file in VC++
Joe M.199308
Look into your project on disk. Is there any *.tlb and/or *.tlh file
The look into *.tlh ( type library header ) and look into the interface class defeintions. There is no mehtod or property to retreive the html.
Maybe someone can help help you with a more easy solution. Maybe there is a trick ot there is a helper interface which does what you want. :-)
Bye
Martin
cakalfurkan44
thanks for your reply..
suggest someother way to save a web page ..
plzz help
bsandlier
MSDN:
C++ programs can retrieve the Component Object Model (COM) interfaces < XML:NAMESPACE PREFIX = MSHelp NS = "http://msdn.microsoft.com/mshelp" />
Here some code in VB ( does the same you want ):
http://www.mvps.org/access/modules/mdl0062.htm
Use body property, get body interface and then use:
innerHTML Sets or retrieves the HTML between the start and end tags of the object.
innerText Sets or retrieves the text between the start and end tags of the object.
Bye
Martin
PKOnline
Try to look at IE. It does the same.
Bye
Martin
ColinJMcGrath
hi,
thanks for your reply,
but is their some code or link to save the web page.
need very urgent..
Andy Brons
You need to code yourself and learn how it is working. Sometimes it is hard work :-)
Bye
Martin
Amaeze
http://www.euromind.com/iedelphi/embeddedwb/utilities.htm
It is Pascal but really straight forward.
Pascal:
function SaveDocToFile(Doc: IDispatch; const Fname: string): HResult;
var
PFile: IPersistFile;
begin
PFile := Doc as IPersistFile;
Result := PFile.Save(StringToOleStr(FName), False);
end;
1. Get document interface pointer from your ActiveX control via document property. Look in definition file for that.
2. Make a cast to IPersistFile
3. Call Save method and you are done.
IHTMLDocument implements IPersistFile which is a general interface for loading and saving.
PUHHH. I'll go in the sun and have beer :-)
Bye
Martin
Rajesh Maskara
You can focus in IPersistFile interface Object.By Google search have more information for VC++.^^
Grade Wang
Reiner
yes implemented this ..
but the problem is that it is going online to fetch the images of the web page..
plzz solve this problem