Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
SHOWHTMLDIALOGEXFN

SHOWHTMLDIALOGEXFN function

Defines the function type for the ShowHTMLDialogEx function.

Syntax


HRESULT STDAPICALLTYPE SHOWHTMLDIALOGEXFN(
  _In_  HWND     hwndParent,
  _In_  IMoniker *pMk,
        DWORD    dwDialogFlags,
  _In_  VARIANT  *pvarArgIn,
  _In_  WCHAR    *pchOptions,
  _Out_ 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 (0x10)

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 (0x10)

Open a modal dialog box.

HTMLDLG_MODELESS (0x10)

Open a modeless dialog box.

HTMLDLG_PRINT_TEMPLATE (0x10)

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 (0x10)

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

If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

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 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 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);



Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows 2000 Server

Header

Mshtmhst.h

DLL

Mshtml.dll;
Mshtml.dll

See also

Creating an HTML Resource

 

 

Show:
© 2015 Microsoft