Export (0) Print
Expand All

SHOWHTMLDIALOGEXFN Function

Defines the function type for the ShowHTMLDialogEx function.

Syntax


typedef HRESULT STDAPICALLTYPE SHOWHTMLDIALOGEXFN (
    HWND hwndParent,
    IMoniker *pMk,
    DWORD dwDialogFlags,
    VARIANT *pvarArgIn,
    WCHAR *pchOptions,
    VARIANT *pvarArgOut
);

Parameters

hwndParent
[in] A handle to the parent of the dialog box. If this value is NULL, the dialog box is not owned.
pMk
[in] The address of an IMoniker interface from which the HTML source content for the dialog box is loaded.
dwDialogFlags
DWORD consisting of a bit-wise OR (|) combination of the following flags. Note that some of these flags are logically mutually exclusive.
HTMLDLG_NOUI
Open the dialog box without a user interface. The dialog box is instantiated, and can run scripts, but is not visible to the user.
HTMLDLG_MODAL
Open a modal dialog box.
HTMLDLG_MODELESS
Open a modeless dialog box.
HTMLDLG_PRINT_TEMPLATE
Open the dialog box as a print template, either for printing or print preview. As a print template, the dialog box can use the TemplatePrinter behavior and access content documents on LayoutRect elements.
HTMLDLG_VERIFY
Force the dialog box to appear on a viewable portion of the desktop. Trusted dialog boxes might or might not open on a visible region of the desktop. Unlike untrusted dialog boxes, which are forced to appear on a viewable portion of the desktop, a trusted dialog box can be positioned anywhere, regardless of the size of the desktop. For example, on an 800x600 monitor, you cannot raise an untrusted dialog box at [900,700]. Instead, the untrusted dialog box is repositioned so that it appears somewhere on the viewable desktop. If the dialog box is trusted, however, it opens successfully, but is invisible to the user, since it is located off the lower-left edge of the screen. This flag allows a trusted dialog box to be "view verified" like an untrusted dialog box.
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.
pchOptions
[in] The window ornaments for the dialog box. This parameter can be NULL or the address of a string that contains a combination of values, separated by semicolons (;). For detailed information, see the description of the features parameter of the IHTMLWindow2::showModalDialog method of the window object.
pvarArgOut
[out] The address of a VARIANT structure that contains the output data for the dialog box. This VARIANT receives the data that was placed in the window object's IHTMLDialog::returnValue property. This parameter can be NULL.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

At least one of the flags HTMLDLG_MODELESS and HTMLDLG_MODAL must be included in dwDialogFlags. If both are declared, HTMLDLG_MODELESS takes precedence over HTMLDLG_MODAL.

Modal dialog boxes created by this method are synchronous; that is, the call to ShowHTMLDialogEx does not return until the dialog box closes. Modeless dialog boxes created by this method are asynchronous; that is, the dialog box is created in a separate process, and the call to ShowHTMLDialogEx returns before the dialog box closes.

To obtain the address of this function, load Mshtml.dll with LoadLibrary, and then retrieve a function pointer for ShowHTMLDialogEx with GetProcAddress. The procedure for calling this function is analogous to the procedure for calling ShowHTMLDialog. A full sample that demonstrates the usage of ShowHTMLDialog is available on the ShowHTMLDialog Sample Source Page.

security note Security Alert  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.

Example

The following example shows the basic steps to load Mshtml.dll, obtain the address of ShowHTMLDialogEx using GetProcAddress, create a URL moniker, and call ShowHTMLDialogEx.


   HINSTANCE hinstMSHTML = LoadLibrary(TEXT("MSHTML.DLL"));

   if (hinstMSHTML == NULL)
   {
       // Error loading module -- fail as securely as possible
       return;
   }

    SHOWHTMLDIALOGEXFN* pfnShowHTMLDialogEx;
    pfnShowHTMLDialogEx = (SHOWHTMLDIALOGEXFN*)GetProcAddress(hinstMSHTML,
                                                              TEXT("ShowHTMLDialogEx"));
    if (pfnShowHTMLDialogEx)
    {
        IMoniker *pURLMoniker;
        BSTR bstrURL = SysAllocString(L"http://www.example.com/dialogsource.htm");
        CreateURLMoniker(NULL, bstrURL, &pURLMoniker);

        if (pURLMoniker)
        {
            DWORD dwFlags = HTMLDLG_MODELESS | HTMLDLG_VERIFY;
            (*pfnShowHTMLDialogEx)(NULL, pURLMoniker, dwFlags, NULL, NULL, NULL);

            pURLMoniker->Release();
        }

        SysFreeString(bstrURL);
    }

    FreeLibrary(hinstMSHTML);


Function Information

Stock Implementation mshtml.dll
Custom Implementation No
Header mshtmhst.h
Import library mshtml.dll
Minimum availability Internet Explorer 4.0
Minimum operating systems Windows NT 4.0, Windows 95, Windows CE 4.0

See Also

Creating an HTML Resource

Community Additions

ADD
Show:
© 2015 Microsoft