Google Gruppi non supporta più i nuovi post o le nuove iscrizioni Usenet. I contenuti storici continuano a essere visibili.

ShowHTMLDialogEx

271 visualizzazioni
Passa al primo messaggio da leggere

cjl

da leggere,
31 mar 2006, 12:55:0231/03/06
a
Hi,

what is the correct way to use the ShowHTMLDialogEx with the
HTMLDLG_PRINT_TEMPLATE option?

The dialog arguments available within the print template are
__IE_ActiveFrame
__IE_BrowseDocument
__IE_ContentDocumentUrl
__IE_ContentSelectionUrl
__IE_DisplayUrl
__IE_FooterString
__IE_HeaderString
__IE_OutlookHeader
__IE_PrinterCmd_DevMode
__IE_PrinterCmd_DevNames
__IE_PrintType
__IE_TemplateUrl

Do these need to be passed in through the pvarArgIn argument to the
ShowHTMLDialogEx function? If so, what is the correct manor in which to do
this? The pvarArgIn arg is a pointer to a VARIANT, so would you build a
VARIANT that contains a SAFEARRAY of these args in a specific order?

Thanks,

CJL

TerryFei

da leggere,
3 apr 2006, 02:40:2103/04/06
a
Hi CJL,
Welcome to MSDN Newsgroup!

We are now researching this issue. We will reply here with more information
as soon as possible. If you have any more concerns on it, please feel free
to post here. Thanks for your understanding!

Best Regards,

Terry Fei [MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security

--------------------
>Thread-Topic: ShowHTMLDialogEx
>thread-index: AcZU7DxcL+hi5WLBRy2SqIOdSqiunw==
>X-WBNR-Posting-Host: 209.92.141.100
>From: =?Utf-8?B?Y2ps?= <c...@nospam.nospam>
>Subject: ShowHTMLDialogEx
>Date: Fri, 31 Mar 2006 09:55:02 -0800
>Lines: 27
>Message-ID: <79CA947D-62D2-42CA...@microsoft.com>
>MIME-Version: 1.0
>Content-Type: text/plain;
> charset="Utf-8"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>Content-Class: urn:content-classes:message
>Importance: normal
>Priority: normal
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
>Newsgroups:
microsoft.public.windows.inetexplorer.ie5.programming.components.webbrowser_
ctl
>Path: TK2MSFTNGXA01.phx.gbl
>Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.windows.inetexplorer.ie5.programming.components.webbrowser_
ctl:6450
>NNTP-Posting-Host: TK2MSFTNGXA01.phx.gbl 10.40.2.250
>X-Tomcat-NG:
microsoft.public.windows.inetexplorer.ie5.programming.components.webbrowser_
ctl

TerryFei

da leggere,
6 apr 2006, 04:03:0506/04/06
a
Hi CIJ,

The proper function type for ShowHTMLDialogEx is defined in Mshtmhst.h in
the SHOWHTMLDIALOGEXFN type. The procedure for calling this function is
analogous to the procedure for calling ShowHTMLDialog. The following
article is about how to use ShowHTMLDialog function. I hope it's useful for
you.
Title: How to use the res: protocol in Developer Studio
URL: http://www.codeproject.com/tips/res.asp

Best Regards,

Terry Fei[MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security

(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
>X-Tomcat-ID: 96868144
>References: <79CA947D-62D2-42CA...@microsoft.com>
>MIME-Version: 1.0
>Content-Type: text/plain
>Content-Transfer-Encoding: 7bit
>From: v-te...@online.microsoft.com ("TerryFei")
>Organization: Microsoft
>Date: Mon, 03 Apr 2006 06:40:21 GMT
>Subject: RE: ShowHTMLDialogEx
>X-Tomcat-NG:
microsoft.public.windows.inetexplorer.ie5.programming.components.webbrowser_
ctl
>Message-ID: <9vaKEmuV...@TK2MSFTNGXA01.phx.gbl>
>Newsgroups:
microsoft.public.windows.inetexplorer.ie5.programming.components.webbrowser_
ctl
>Lines: 54

>Path: TK2MSFTNGXA01.phx.gbl
>Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.windows.inetexplorer.ie5.programming.components.webbrowser_

ctl:6454
>NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122

cjl

da leggere,
6 apr 2006, 09:27:0206/04/06
a
Hi,

Your answer and the article referenced has nothing to do with my question.
The ShowHTMLDialog function does not even have a dwDialogFlags argument, so
how could it possibly be relevant?

I want to know how to use the HTMLDLG_PRINT_TEMPLATE option and the
pvarArgIn argument when using that option. This is only available through
the ShowHTMLDialogEx function. Please read my original post for further
information.

I had got my hopes up when you suggested you were "researching this issue".
Someone at MS must have the capability of looking at the code and seeing how
that option is supposed to be used and what parameters it is looking for.

CJL

TerryFei

da leggere,
9 apr 2006, 23:03:5509/04/06
a
Hi CIJ,

I think you just need to Exec() the standard Print command and pass the
path to your printer template html as a BSTR variant in the pvarArgIn
param. Trident will do the showModalDialog call and setup the
dialogArguments for you.

MSDN has examples:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnie55/html
/beyondprintpreview.asp?frame=true

I hope the above information is helpful for you. Thanks!

Best Regards,

Terry Fei[MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
>Thread-Topic: ShowHTMLDialogEx
>thread-index: AcZZfcpkkuUqiC/dTA25Eic2XBFV6g==


>X-WBNR-Posting-Host: 209.92.141.100
>From: =?Utf-8?B?Y2ps?= <c...@nospam.nospam>

>References: <79CA947D-62D2-42CA...@microsoft.com>
<9vaKEmuV...@TK2MSFTNGXA01.phx.gbl>
<AhhURCVW...@TK2MSFTNGXA01.phx.gbl>
>Subject: RE: ShowHTMLDialogEx
>Date: Thu, 6 Apr 2006 06:27:02 -0700
>Lines: 142
>Message-ID: <CE1280D5-C964-4DCE...@microsoft.com>


>MIME-Version: 1.0
>Content-Type: text/plain;
> charset="Utf-8"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>Content-Class: urn:content-classes:message
>Importance: normal
>Priority: normal
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
>Newsgroups:
microsoft.public.windows.inetexplorer.ie5.programming.components.webbrowser_
ctl
>Path: TK2MSFTNGXA01.phx.gbl
>Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.windows.inetexplorer.ie5.programming.components.webbrowser_

ctl:6458


>NNTP-Posting-Host: TK2MSFTNGXA01.phx.gbl 10.40.2.250
>X-Tomcat-NG:
microsoft.public.windows.inetexplorer.ie5.programming.components.webbrowser_
ctl
>

cjl

da leggere,
16 apr 2006, 08:51:0216/04/06
a
Terry,

No offense, but please stop posting here if you did not intend to acutally
answer the question at hand. I am using my email with a 2 day response and
your posts, however well intentioned, make it seem that I have been responded
to. Now I may have to start another thread to try and get a valid 2-day
reply.

I would have responded sooner, but I have just come back from a stay in the
hospital.

Thank you for you efforts,

cjl

da leggere,
22 apr 2006, 08:30:0222/04/06
a
Hi,

I am trying to use the ShowHTMLDialogEx function with the
HTMLDLG_PRINT_TEMPLATE option.

What should the VARIANT pvarArgIn argument contain for this to work properly?

MSDN docs state the dialog arguments available within the print template are

Jeffrey Tan[MSFT]

da leggere,
24 apr 2006, 03:23:5624/04/06
a
Hi CJL,

I will perform some research regarding this issue. I will reply to you
ASAP. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

cjl

da leggere,
24 apr 2006, 16:05:0124/04/06
a
Thanks,

I Look forward to your reply.

CJL

Jeffrey Tan[MSFT]

da leggere,
26 apr 2006, 02:32:3326/04/06
a
Hi CJL,

Yes, I still can not find much document regarding this usage. I will work
with our IE SDK support engineer on this issue. I will feedback any
progress here. Thanks

cjl

da leggere,
12 mag 2006, 19:43:0112/05/06
a
Hi,

any luck with this one?

CJL

Jeffrey Tan[MSFT]

da leggere,
14 mag 2006, 22:06:5414/05/06
a
Hi CJL,

Sorry for letting you wait.

Yes, I have escalated this issue to another WebBrowser speciality team, and
based on the feedback 2 days before, they are still researching on it. I
will feedback any update here. Thanks for your understanding.

cjl

da leggere,
16 mag 2006, 07:55:0216/05/06
a
Thanks for the reply and continued investigation.

I wonder if mshtml is using this function or something that calls it when
getting an IDM_PRINT or IDM_PRINTPREVIEW.

CJL

Jeffrey Tan[MSFT]

da leggere,
16 mag 2006, 22:55:3316/05/06
a
Hi CJL,

Sorry for the late response.

Our support engineer is currently checking the source code. Based on the
research log, we have found something for this, but we are contacting the
product dev team for confirmation on the findings. I will update you, once
we get the confirmation.

Thanks for your understanding and patient.

Luke Zhang [MSFT]

da leggere,
2 giu 2006, 06:41:4802/06/06
a

pvarArgIn is a variant of type IHTMLEventObj2. This object has expandos on
it (basically added attributes whose name/value is specified by the user),

which are used by the print handler. You set these attributes by calling
setAttribute on this object, specifying the name/value pair.

In short, you need an IHTMLEventObj2 object, and you need to call
setAttribute on it for each of the attributes you want to set. You then
cast this to a variant

of IUNKNOWN, and the HTML dialog code will attempt to cast it back to an
IHTMLEventObj2 object and read the attributes off of it.

I don't think you need to specify all of these attributes. In fact, I think
you can pass NULL for this structure if you are happy with the defaults.

Here's an example. If you wanted to set the template URL, and you had this
URL in an LPSTR (pstrTemplate), you would set it in the following fashion:

// ... code to create the IHTMLEventObj2 object, pEvObj2...

IHTMLEventObj * pEventObj = NULL;

IHTMLEventObj2 * pEvObj2= NULL;

// Create the event object as a holder for the parameters to pass

//---------------------------------

hr = CEventObj::Create(&pEventObj, NULL, NULL, NULL, FALSE, NULL, NULL,
TRUE);

hr = pEventObj->QueryInterface(IID_IHTMLEventObj2, (void**)& pEvObj2);

Variant cvarTemp;

// Set the template URL

//---------------------------------

if (pstrTemplate)

{

V_VT(&cvarTemp) = VT_BSTR;

V_BSTR(&cvarTemp) = SysAllocString(pstrTemplate);

}

else

{

VariantClear(cvarTemp);

}

pEvObj2->setAttribute(_T("__IE_TemplateUrl"), cvarTemp, 0);

VariantClear(cvarTemp);

// Set the Parent HWND

//---------------------------------

V_VT(&cvarTemp) = VT_UINT;

V_UINT(&cvarTemp) = HandleToUlong(parentHWND);

pEvObj2->setAttribute(_T("__IE_ParentHWND"), cvarTemp, 0);

cvarTemp.Clear();

// set the Header string

//---------------------------------

V_VT(&cvarTemp) = VT_BSTR;

V_BSTR(&cvarTemp) = bstrHeader;

pEvObj2->setAttribute(_T("__IE_HeaderString"), cvarTemp, 0);

cvarTemp.ZeroVariant();

etc…

You would then cast this pEventObj2 to a variant to pass into the dialog
function:

V_UNKNOWN(&cvarIn) = pEvObj2;

ShowHTMLDialogEx(hwndParent,

pMk,

dwDialogFlags,

&cvarIn,

pchOptions,

pvarArgOut);


Luke Zhang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

cjl

da leggere,
22 giu 2006, 10:38:0222/06/06
a
Hi,

Thank you for the reply.

I think I am much closer to getting this working, however, after running the
following code, I only see the print template without the document to be
print previewed.

mshtml.IHTMLDocument4 doc = webBrowser1.Document.DomDocument as
mshtml.IHTMLDocument4;

mshtml.IHTMLEventObj2 eventObj2;
object varObj = null;
eventObj2 = doc.CreateEventObject(ref varObj) as
mshtml.IHTMLEventObj2;

using (StreamWriter writer = new
StreamWriter("c:\\printtempfile.html"))
{

writer.Write(((mshtml.IHTMLDocument3)webBrowser1.Document.DomDocument).documentElement.outerHTML);
}

IMoniker moniker = CreateURLMoniker(null,
"file://c:\\printtemplate.html");

eventObj2.setAttribute("__IE_ParentHWND", this.Handle, 0);
eventObj2.setAttribute("__IE_TemplateUrl",
"file://c:\\printtemplate.html", 0);
eventObj2.setAttribute("__IE_PrintType", "Preview", 0);
eventObj2.setAttribute("__IE_BrowseDocument",
webBrowser1.Document.DomDocument as mshtml.IHTMLDocument, 0);
eventObj2.setAttribute("__IE_ContentDocumentUrl",
"file://c:\\printtempfile.html", 0);

string options = string.Empty;

object argIn = eventObj2;

int res = ShowHTMLDialogEx(new HandleRef(this, Handle), moniker,
0x80 | 0x20, ref argIn, options);

Am I passing in the parameters correctly? I could provide a complete sample
solution if need be. In the print template, I have verified that the dialog
arguments are available, but nothing gets printed.

I am using C# and interop to accomplish this.

I have defined the following functions for interop:

[DllImport("urlmon.dll", PreserveSig = false)]
private static extern IMoniker
CreateURLMoniker([MarshalAs(UnmanagedType.Interface)]IMoniker pmkContext,
[MarshalAs(UnmanagedType.LPWStr)] string szURL);

[DllImport("mshtml.dll", PreserveSig=false)]
private static extern int ShowHTMLDialogEx(HandleRef hwndParent,
[MarshalAs(UnmanagedType.Interface)] IMoniker pMk,
[MarshalAs(UnmanagedType.U4)] int dwDialogFlags, [In] ref object pvarArgIn,
[MarshalAs(UnmanagedType.LPWStr)] string pchOptions);

Jeffrey Tan[MSFT]

da leggere,
23 giu 2006, 04:41:0923/06/06
a
Hi CJL,

Ok, I will perform some research on this issue. I will update you ASAP.
Thanks.

Best regards,
Jeffrey Tan


Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Jeffrey Tan[MSFT]

da leggere,
27 giu 2006, 03:31:4727/06/06
a
Hi Scott,

Thanks for your patient.

Can you send me a complete reproduce sample project? This will be efficient
for us to work it out. Thanks.

Best regards,
Jeffrey Tan


Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

cjl

da leggere,
30 giu 2006, 08:35:0230/06/06
a
I have emailed you a sample project at je...@microsoft.com.

If this is not the correct email address, please advise me on how I should
deliver the sample project to you.

Thank you for your time on this matter,

C Larkin

Jeffrey Tan[MSFT]

da leggere,
2 lug 2006, 22:41:5702/07/06
a
Hi Larkin,

Yes, we have received your sample project, I will perform some research on
it and reply to you ASAP. Thanks.

Jeffrey Tan[MSFT]

da leggere,
6 lug 2006, 04:24:3606/07/06
a
Hi Larkin,

By looking on your sample, looks like you wants to use print template.
Normally, the print template path is passed to webBrowser control in the
pVarArgin VARIANT argument to IOleCommandTarget::Exec. You can see details
with code snippet here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnie55/html
/beyondprintpreview.asp

Does this meet your need?

cjl

da leggere,
6 lug 2006, 09:38:0206/07/06
a
Hi,

I originally started this thread so that I could find out how to use the
print template with the ShowHTMLDialogEx function and the
HTMLDLG_PRINT_TEMPLATE option. In the documentation it states that a
combination of HTMLDLG_PRINT_TEMPLATE |
HTMLDLG_MODAL should do this.

I have since discovered that I have to pass in a ref to a IHTMLEventObj2
class with the proper arguments. The sample is passing in the suggested
args, the print template is being display, but I it is not actually printing.

Jeffrey Tan[MSFT]

da leggere,
7 lug 2006, 02:28:1007/07/06
a
Hi Larkin,

Thanks for your feedback!

I have sent an email to you regarding this issue. Please check it and
follow up my email. Thanks.

0 nuovi messaggi