This is the discussion forum for the HtmlEditor. See also the
HtmlEditor home page, where you can download the control, and the
Documentation Wiki, a collaborative project for documenting the control.
mshtml printpreview
Posted by:
CJL (---.exscribe.com)
Date: Wednesday, 13-Jul-2005, 15:17:05
Hi,
Anyone have any suggestions on how to trap the default print preview window, make it into a child window and place it in a custom form?
As an example, for anyone with MS infopath, look at the print preview of the forms. InfoPath is using mshtml, displaying html in a print preview mode, but in a window of its own with an MSO Command Bar at the top. Using Spy++ you can verify this. If they are using the IOleCommandTarget and IDM_PRINTPREVIEW, they must be using their own print template (since the html toolbar is gone) and they must be trapping the window creation and changing the create params to make it into a child window. If they are not using IDM_PRINTPREVIEW, they what method are they using? Mshtml does not seem to support the IPrint interface or the IInplacePrintPreview interface that some other Office ActiveX Documents support.
Any suggestions?
CJL
Re: mshtml printpreview
Posted by:
peter (---.vic.westnet.com.au)
Date: Wednesday, 26-Oct-2005, 02:58:27
Hi CJL,
I've been looking for the same information for a while. But it looks like there is no print template(or printDocument) we can get from mshtml. I find a program that create an image from an html page(which can be customized browser editor) and display on the picture box. -- I thought that can be imitate the printpreview but not suitable for the solution.
Anyway, if you've found any reasonable solution, please let me know.
regards,
peter
Re: mshtml printpreview
Posted by:
cjl (---.exscribe.com)
Date: Tuesday, 14-Mar-2006, 15:57:55
Hi,
I have been looking for a solution to this for awhile, but the best I have come up with is a dodgy at best. I print to a hidden window, capture the handle of the Print Preview Dialog, add the WS_CHILD style to it, and add it as a child window to a panel.
There must be a cleaner way to do this, whether it is available outside MS is not clear. I have even posted on the msdn managed newsgroups to no avail. There are many, many undocumented commands to mshtml and shdocvw.
If you open up IE and investigate the windows with spy++, you'll find an inner window with a window class of "Internet Explorer_Server". This is the mshtml activex document. If you print preview and examine that window with spy++ you will find that the inner window is of the same window class. The difference is that the default print template has been loaded and fed the document from the original IE window. There must be a command to do this directly to the mshtml window. IDM_PRINTPREVIEW tells it to open a new window, use a new mshtml activex document and display it there. So there must be some way (Command to send IOleCommandTarget, undocument function in the mshtml dll, or custom window messgae) to pass that mshtml window a print template and IHTMLDocument to display.