how to save html file in VC++

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..
[267 byte] By [thelastdevil] at [2007-12-16]
# 1
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 IHTMLDocument, IHTMLDocument2, and IHTMLDocument3 by calling QueryInterface on the IDispatch received from this property.
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

maddin123 at 2007-9-9 > top of Msdn Tech,Visual C++,Visual C++ General...
# 2
hi,
thanks for your reply..
suggest someother way to save a web page ..
plzz help
thelastdevil at 2007-9-9 > top of Msdn Tech,Visual C++,Visual C++ General...
# 3
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. :-)

Bye
Martin

maddin123 at 2007-9-9 > top of Msdn Tech,Visual C++,Visual C++ General...
# 4
A very nice site for that is: http://www.euromind.com/iedelphi/ie5tools/ieautomate.htm
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

maddinthegreat at 2007-9-9 > top of Msdn Tech,Visual C++,Visual C++ General...
# 5
hi,
yes implemented this ..
but the problem is that it is going online to fetch the images of the web page..
plzz solve this problem
thelastdevil at 2007-9-9 > top of Msdn Tech,Visual C++,Visual C++ General...
# 6
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.

Try to look at IE. It does the same.

Bye
Martin

maddinthegreat at 2007-9-9 > top of Msdn Tech,Visual C++,Visual C++ General...
# 7

hi,
thanks for your reply,
but is their some code or link to save the web page.
need very urgent..

thelastdevil at 2007-9-9 > top of Msdn Tech,Visual C++,Visual C++ General...
# 8
Just Google. I C++ i don't know.
You need to code yourself and learn how it is working. Sometimes it is hard work :-)

Bye
Martin

maddinthegreat at 2007-9-9 > top of Msdn Tech,Visual C++,Visual C++ General...
# 9

You can focus in IPersistFile interface Object.By Google search have more information for VC++.^^

Grade Wang

grade at 2007-9-9 > top of Msdn Tech,Visual C++,Visual C++ General...