Contents Index Topic Contents | ||
Previous Topic: Overview Next Topic: SHOWHTMLDIALOGFN |
HTML Dialog Boxes
IE4/MSHTML allows you to create a modal dialog box that displays HTML. This is accomplished using the ShowHTMLDialog function that is implemented in Mshtml.dll.
Using ShowHTMLDialog
To use ShowHTMLDialog, it is necessary to dynamically load and then call this function by using the LoadLibrary and GetProcAddress functions. The SHOWHTMLDIALOGFN type is defined in Mshtmhst.h to define the proper function type for ShowHTMLDialog. The HTMLDlg sample in the Internet Client SDK shows a complete example using ShowHTMLDialog, including how to pass data to and receive data from the dialog. The following example shows how to obtain the address of the ShowHTMLDialog function:
#include <windows.h> #include <mshtmhst.h> { HINSTANCE hinstMSHTML = LoadLibrary(TEXT("MSHTML.DLL")); if(hinstMSHTML) { SHOWHTMLDIALOGFN *pfnShowHTMLDialog; pfnShowHTMLDialog = (SHOWHTMLDIALOGFN*)GetProcAddress(hinstMSHTML, TEXT("ShowHTMLDialog")); if(pfnShowHTMLDialog) { /* Perform initialization and then call ShowHTMLDialog. */ } FreeLibrary(hinstMSHTML); } }The HTML for the dialog box is loaded from an IMoniker interface that is passed in the pmk parameter in ShowHTMLDialog. This moniker can be any moniker that evaluates to any HTML source or to a resource that uses the res: protocol. The CreateURLMoniker function can be used to create the IMoniker interface that is passed to ShowHTMLDialog.
The input parameters for the dialog box are passed in the pvaArgIn parameter in ShowHTMLDialog. The input parameters can be any information that can be passed in a VARIANT structure. In the dialog box HTML source, the input parameters are obtained from the dialogArguments property of the window object.
The output parameters for the dialog box are returned in the pvaArgOut parameter in ShowHTMLDialog. This is a VARIANT structure that you allocate. This structure must be initialized using the VariantInit function before calling ShowHTMLDialog. In the dialog box HTML source, the output parameters are set using the returnValue property of the window object.
Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.