Share via


SHOWHTMLDIALOGFN function

Defines the function type for ShowHTMLDialog.

Syntax

HRESULT STDAPICALLTYPE SHOWHTMLDIALOGFN(
   HWND     hwndParent,
   IMoniker *pMk,
   VARIANT  *pvarArgIn,
   WCHAR    *pchOptions,
   VARIANT  *pvarArgOut
);

Parameters

  • hwndParent
    A handle to the window that is the owner of the dialog box. This window is disabled for the life of the dialog box. If this value is NULL, the dialog box is not owned.

  • pMk
    The address of an IMoniker interface that identifies the source of the HTML that is contained in the dialog box.

  • pvarArgIn
    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
    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 semicolons (;). See the description of the features parameter of the IHTMLWindow2::showModalDialog method of the window object for detailed information.

  • pvarArgOut
    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

This function creates a modal dialog box that contains HTML. The function does not return until the dialog box has been dismissed. To obtain the address of this function, load Mshtml.dll with LoadLibrary, and then retrieve the address of ShowHTMLDialog with GetProcAddress.

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

    SHOWHTMLDIALOGFN* pfnShowHTMLDialog;
    pfnShowHTMLDialog = (SHOWHTMLDIALOGFN*)GetProcAddress(hinstMSHTML,
                                                              TEXT("ShowHTMLDialog"));
    if (pfnShowHTMLDialog)
    {
        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, 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