 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Rob Kemp Guest
|
Posted: Wed Nov 19, 2003 1:30 pm Post subject: Save an HTML as an mht |
|
|
Hi,
My application uses cppwebbrowser. Does anyone know how to enable the user to save the html page he/she's viewing as web archive (mht) [the second option in the pull down menu on the IE save as dialog]
thanks in advance
Rob
|
|
| Back to top |
|
 |
Hans Galema Guest
|
Posted: Wed Nov 19, 2003 4:11 pm Post subject: Re: Save an HTML as an mht |
|
|
Rob Kemp wrote:
| Quote: | My application uses cppwebbrowser. Does anyone know how to enable the user to save the html page he/she's viewing as web archive (mht) [the second option in the pull down menu on the IE save as dialog]
|
Please wrap your lines manually.
Try:
void __fastcall TForm1::SpeedButton17Click(TObject *Sender)
{
AnsiString FileName = ExtractFilePath ( ParamStr (0) )
+ "ExecWB.OLECMDID_SAVEAS.html";
char filename [MAXPATH];
strcpy ( filename, FileName.c_str() );
TVariant Variant = filename;
CppWebBrowser1->ExecWB(
Shdocvw_tlb::OLECMDID_SAVEAS,
Shdocvw_tlb::OLECMDEXECOPT_DODEFAULT, &Variant );
}
Hans.
|
|
| Back to top |
|
 |
rob kemp Guest
|
Posted: Wed Nov 19, 2003 6:17 pm Post subject: Re: Save an HTML as an mht |
|
|
Hans,
Thank you..But I miss quoted what I am using.
I am using BCB4 Pro with Active X WebBrower_V11 and not CppWebBrowser.
Therefore, when I compile, I get the following error
[C++ Error] Unit11.cpp(254): E2316 'ExecWB' is not a member of 'TWebBrowser_V1'.
Is there a workaround for WebBrowser_V11?
thanks in advance
Rob
Hans Galema <dontusethis (AT) dontusethis (DOT) nl> wrote:
| Quote: | Rob Kemp wrote:
My application uses cppwebbrowser. Does anyone know how to enable the user to save the html page he/she's viewing as web archive (mht) [the second option in the pull down menu on the IE save as dialog]
Please wrap your lines manually.
Try:
void __fastcall TForm1::SpeedButton17Click(TObject *Sender)
{
AnsiString FileName = ExtractFilePath ( ParamStr (0) )
+ "ExecWB.OLECMDID_SAVEAS.html";
char filename [MAXPATH];
strcpy ( filename, FileName.c_str() );
TVariant Variant = filename;
CppWebBrowser1->ExecWB(
Shdocvw_tlb::OLECMDID_SAVEAS,
Shdocvw_tlb::OLECMDEXECOPT_DODEFAULT, &Variant );
}
Hans.
|
|
|
| Back to top |
|
 |
rob kemp Guest
|
Posted: Wed Nov 19, 2003 7:08 pm Post subject: Re: Save an HTML as an mht |
|
|
Hans,
I created it by importing an ActiveX control and chose Microsoft Internet Contro V1.1.
If I decide to quit using this component and let the user
browse the Internet using IE. How can I set a
button on my application sho when clicked, the page
being viewed by IE is automatically saved as a MHT.
Thanks Hans for your replies
Rob
Hans Galema <dontusethis (AT) dontusethis (DOT) nl> wrote:
| Quote: | rob kemp wrote:
WebBrower_V11 and not CppWebBrowser.
'TWebBrowser_V1'.
Well what is it ? A Google newsgroup search does not bring anything
whit these names. How is it named by bcb4 if you drop a component
on a form ?
Is there a workaround for WebBrowser_V11?
You could try (untested) something like:
TVariant vIn, vOut;
CppWebBrowser1->ControlInterface->ExecWB(
Shdocvw_tlb::OLECMDID_PRINTPREVIEW,
Shdocvw_tlb::OLECMDEXECOPT_DONTPROMPTUSER, &vIn, &vOut);
thanks in advance
Afterwards ?
Hans.
|
|
|
| Back to top |
|
 |
Hans Galema Guest
|
Posted: Wed Nov 19, 2003 7:49 pm Post subject: Re: Save an HTML as an mht |
|
|
rob kemp wrote:
| Quote: | WebBrower_V11 and not CppWebBrowser.
'TWebBrowser_V1'.
|
Well what is it ? A Google newsgroup search does not bring anything
whit these names. How is it named by bcb4 if you drop a component
on a form ?
| Quote: | Is there a workaround for WebBrowser_V11?
|
You could try (untested) something like:
TVariant vIn, vOut;
CppWebBrowser1->ControlInterface->ExecWB(
Shdocvw_tlb::OLECMDID_PRINTPREVIEW,
Shdocvw_tlb::OLECMDEXECOPT_DONTPROMPTUSER, &vIn, &vOut);
Afterwards ?
Hans.
|
|
| Back to top |
|
 |
rob kemp Guest
|
Posted: Wed Nov 19, 2003 9:13 pm Post subject: For Hans: Re: Save an HTML as an mht |
|
|
Hans,
I managed to get it working, when the user click on a button,
the standard IE's SAVE AS dialog appears. Now I have to type file name and to choose encoding and save options (html, text,
etc).
Is it possible to avoid manual input and pass all necessary
parameters directly from the procedure?
I need to sava the file as MHT and save it to c:Temp
Thank you.
Rob
"rob kemp" <Masf140571 (AT) yahoo (DOT) com> wrote:
| Quote: |
Hans,
I created it by importing an ActiveX control and chose Microsoft Internet Contro V1.1.
If I decide to quit using this component and let the user
browse the Internet using IE. How can I set a
button on my application sho when clicked, the page
being viewed by IE is automatically saved as a MHT.
Thanks Hans for your replies
Rob
Hans Galema <dontusethis (AT) dontusethis (DOT) nl> wrote:
rob kemp wrote:
WebBrower_V11 and not CppWebBrowser.
'TWebBrowser_V1'.
Well what is it ? A Google newsgroup search does not bring anything
whit these names. How is it named by bcb4 if you drop a component
on a form ?
Is there a workaround for WebBrowser_V11?
You could try (untested) something like:
TVariant vIn, vOut;
CppWebBrowser1->ControlInterface->ExecWB(
Shdocvw_tlb::OLECMDID_PRINTPREVIEW,
Shdocvw_tlb::OLECMDEXECOPT_DONTPROMPTUSER, &vIn, &vOut);
thanks in advance
Afterwards ?
Hans.
|
|
|
| Back to top |
|
 |
Hans Galema Guest
|
Posted: Wed Nov 19, 2003 10:27 pm Post subject: Re: For Hans: Re: Save an HTML as an mht |
|
|
rob kemp wrote:
| Quote: | I managed to get it working,
|
Please don't let this be a one wat traffic.
How ?
Hans.
|
|
| Back to top |
|
 |
rob kemp Guest
|
Posted: Thu Nov 20, 2003 2:14 pm Post subject: Re: For Hans: Re: Save an HTML as an mht |
|
|
I managed to get working by using WebBrowser instead of WebBrowser_V11 (both imported ActiveX from Microsoft Internet Controls)
I tried the code you sent (thanks)to save a web page.
void __fastcall TForm1::SpeedButton17Click(TObject *Sender)
{
AnsiString FileName = ExtractFilePath ( ParamStr (0) )
+ "ExecWB.OLECMDID_SAVEAS.html";
char filename [MAXPATH];
strcpy ( filename, FileName.c_str() );
TVariant Variant = filename;
CppWebBrowser1->ExecWB(
Shdocvw_tlb::OLECMDID_SAVEAS,
Shdocvw_tlb::OLECMDEXECOPT_DODEFAULT, &Variant );
}
When I execute this command, the standard IE's SAVE AS dialog
appears.Now I have to type file name and to choose encoding
and save options(html, text, etc).
Is it possible to avoid manual input and pass all necessary
parameters directly from the procedure?
I need to save the page as MHT and save it to c:MyFolder
Can please be kind enough to send the syntax that I should use
Thank you.
Hans Galema <dontusethis (AT) dontusethis (DOT) nl> wrote:
| Quote: | rob kemp wrote:
I managed to get it working,
Please don't let this be a one wat traffic.
How ?
Hans.
|
|
|
| Back to top |
|
 |
Hans Galema Guest
|
Posted: Thu Nov 20, 2003 6:05 pm Post subject: Re: For Hans: Re: Save an HTML as an mht |
|
|
rob kemp wrote:
| Quote: | Is it possible to avoid manual input and pass all necessary
parameters directly from the procedure?
|
No. Not as far as I know. You can see that too just when you try to
specify DONTPROMPTUSER witht the SAVEAS dialog. The dialog always comes.
This is a safety issue.
Google around for DONTPROMPUSER (first get the exact phrase) and
then you will find many discussions about the save dialog that always
comes. Finally you will find a post which states that it is the safety issue.
| Quote: | I need to save the page as MHT and save it to c:MyFolder
|
Then you have to extract the page in the normal way and convert it
to MHT. I do not know how to do that. I do not know the MHT specification.
| Quote: | Can please be kind enough to send the syntax that I should use
|
Sorry.
Hans.
|
|
| Back to top |
|
 |
Hans Galema Guest
|
Posted: Fri Nov 21, 2003 11:35 am Post subject: Re: For Hans: Re: Save an HTML as an mht |
|
|
Hans Galema wrote:
| Quote: | ... do not know how to do that. I do not know the MHT specification.
|
Did a little test. Saved a html page with IE as mht.
If I doubleclick the file in explorer it opens in IE like the original
html file.
Opening in notepad shows that it is like an email containing a multi-part
message in MIME format. The complete source of the html file follows
and then the images base64 encoded.
If you really need to export like mht you could implement that if you wanted.
Hans.
|
|
| Back to top |
|
 |
rob kemp Guest
|
Posted: Fri Nov 21, 2003 1:42 pm Post subject: Re: For Hans: Re: Save an HTML as an mht |
|
|
Hans,
Saving a web page as mht is pretty useful as the saved file is a single file that contains all the images, tables, etc. compared to saving as html which creates a seperate folder for the the borders, images, etc.
cheers
Rob
Hans Galema <dontusethis (AT) dontusethis (DOT) nl> wrote:
| Quote: | Hans Galema wrote:
... do not know how to do that. I do not know the MHT specification.
Did a little test. Saved a html page with IE as mht.
If I doubleclick the file in explorer it opens in IE like the original
html file.
Opening in notepad shows that it is like an email containing a multi-part
message in MIME format. The complete source of the html file follows
and then the images base64 encoded.
If you really need to export like mht you could implement that if you wanted.
Hans.
|
|
|
| Back to top |
|
 |
Hans Galema Guest
|
Posted: Fri Nov 21, 2003 7:09 pm Post subject: Re: For Hans: Re: Save an HTML as an mht |
|
|
rob kemp wrote:
| Quote: | Saving a web page as mht is pretty useful as the saved file is a single file that contains all the images, tables, etc. compared to saving as html which creates a seperate folder for the the borders, images, etc.
|
Yes, that is exactly what I 'discovered' and told in the post.
So it is not about the usefullness but about how to do it.
And what I told is that you could construct a mht file yourself.
Hans.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|