ShowModelessHTMLDialog function
Creates a modeless dialog box that displays HTML.
Syntax
HRESULT ShowModelessHTMLDialog(
_In_ HWND hwndParent,
_In_ IMoniker *pMk,
_In_ VARIANT *pvarArgIn,
_In_ VARIANT *pvarOptions,
_Out_ IHTMLWindow2 **ppWindow
);
Parameters
hwndParent [in]
A handle to the parent of the dialog box.pMk [in]
The address of an IMoniker interface from which the HTML for the dialog box is loaded.pvarArgIn [in]
The address of a VARIANT structure that contains the input data for the dialog box. The data passed in this VARIANT is placed in the window object's IHTMLDialog::dialogArguments property. This parameter can be NULL.pvarOptions [in]
The window ornaments for the dialog box. This parameter can be NULL or a VARIANT of type VT_BSTR that contains a combination of values, separated by semicolons (;). See the description of the features parameter of the IHTMLWindow2::showModalDialog method of the window object for detailed information.ppWindow [out]
The address of a pointer to an IHTMLWindow2 interface for the dialog box.
Return value
If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Remarks
To use ShowModelessHTMLDialog, which is implemented in Mshtml.dll, you must dynamically load and call this function by using the LoadLibrary function and the GetProcAddress function. The proper function type for ShowModelessHTMLDialog is defined in Mshtmhst.h in the SHOWMODELESSHTMLDIALOGFN type. The procedure for calling this function is analogous to the procedure for calling ShowHTMLDialog. A full sample that demonstrates the use of ShowHTMLDialog is available on the ShowHTMLDialog Sample Source Page.
For additional information on dialog boxes, dialog box options, and the default unit of measure used, see IHTMLWindow2::showModalDialog.
Security Warning: Using LoadLibrary incorrectly can compromise the security of your application by loading the wrong DLL. Refer to the LoadLibrary documentation for information on how to correctly load DLLs with different versions of Windows.
Examples
The following example shows the basic steps to load Mshtml.dll, obtain the address of ShowModelessHTMLDialog using GetProcAddress, create a URL moniker, and call ShowModelessHTMLDialog.
HINSTANCE hinstMSHTML = LoadLibrary(TEXT("MSHTML.DLL"));
if (hinstMSHTML == NULL)
{
//Error loading module -- fail as securely as possible
return;
}
SHOWMODELESSHTMLDIALOGFN* pfnShowModelessHTMLDialog;
pfnShowModelessHTMLDialog =
(SHOWMODELESSHTMLDIALOGFN*)GetProcAddress(hinstMSHTML,
TEXT("ShowModelessHTMLDialog"));
if (pfnShowModelessHTMLDialog)
{
IMoniker *pURLMoniker;
BSTR bstrURL =
SysAllocString(L"http://www.example.com/dialogsource.htm");
CreateURLMoniker(NULL, bstrURL, &pURLMoniker);
if (pURLMoniker)
{
DWORD dwFlags = HTMLDLG_MODELESS | HTMLDLG_VERIFY;
(*pfnShowModelessHTMLDialog)(NULL, pURLMoniker, NULL,
NULL, NULL);
pURLMoniker->Release();
}
SysFreeString(bstrURL);
}
FreeLibrary(hinstMSHTML);
Requirements
Minimum supported client |
Windows XP |
Minimum supported server |
Windows 2000 Server |
Header |
Mshtmhst.h |
DLL |
Mshtml.dll; Mshtml.dll |