下面是MSDN上的解释(关注红色部分):
Command group CGID_MSHTML (defined in mshtmhst.h)
Symbolic constant IDM_PRINT
User interface Optional. Set nCmdExecOpt to OLECMDEXECOPT_DODEFAULT or OLECMDEXECOPT_PROMPTUSER to display the print dialog. Set nCmdExecOpt to OLECMDEXECOPT_DONTPROMPTUSER to send the document directly to the current printer without invoking the dialog.
IOleCommandTarget::Exec parameters pvaIn VARIANT of type VT_BSTR, VT_I2, or VT_ARRAY. If pvaIn is a VARIANT of type VT_BSTR, pvaIn specifies the path to a custom print template.
If pvaIn is a VARIANT of type VT_I2, pvaIn can be set with the flags PRINT_DONTBOTHERUSER(0x01) and PRINT_WAITFORCOMPLETION(0x02) defined in mshtmhst.h . If 0 is specified, then the default behavior (show print dialog and do not wait for completion) occurs unless otherwise defined by the nCmdExecOpt parameter.
If pvaIn is a VARIANT of type VT_ARRAY, pvaIn specifies a SAFEARRAY containing (in the following order) a header BSTR, a footer BSTR, the address of an IStream pointer for a Microsoft Outlook Express header document, an alternate URL BSTR used for MSHTML in Outlook Express, and a DWORD containing flags.
Can be set to NULL to use the Microsoft Internet Explorer default print template.
其中第5点似乎用得上。
When you use an OLECMDID enumeration of the OLECMDID_PRINT element together with the ExecWB method, you can specify extended printing information by passing in the SAFEARRAY structure through the VARIANT argument pvaIn. This SAFEARRAY data type takes a maximum of five items:
A string (BSTR) that contains a custom header.
A string (BSTR) that contains a custom footer.
An IStream object that contains an HTML file that serves as an "optional header." This is the e-mail header that you see in Microsoft Outlook and Microsoft Outlook Express e-mail messages when you print them. This IStream object must point to a full, valid HTML document, not to HTML fragments, or it will print incorrectly.
An alternative URL to use for the document. This is only relevant to Outlook and to Outlook Express. A set of printing flags (dwFlags) to configure the printer. This is only relevant to Outlook and to Outlook Express.