ShowHTMLDialog method

Creates a trusted, modal dialog box that displays HTML.

Syntax


HRESULT retVal = object.ShowHTMLDialog(hwndParent, pMk, pvarArgIn, pchOptions, pvarArgOut, punkHost);

Parameters

hwndParent [in]

Type: HWND

An HWND that specifies a handle to the parent of the dialog box. This parameter can be set to NULL.

pMk [in]

Type: IMoniker

A pointer to an IMoniker interface from which the HTML for the dialog box is loaded.

pvarArgIn [in]

Type: VARIANT

A pointer to 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 set to NULL.

pchOptions [in]

Type: WCHAR

A pointer to the beginning of a wide character string that contains information about window ornaments for the dialog box, using one or more of the following semicolon-delimited values.

dialogHeight:sHeight

Sets the height of the dialog window.

dialogLeft:sXPos

Sets the left position of the dialog window relative to the upper-left corner of the desktop.

dialogTop:sYPos

Sets the top position of the dialog window relative to the upper-left corner of the desktop.

dialogWidth:sWidth

Sets the width of the dialog window (see Remarks for default unit of measure).

center:{ yes | no | 1 | 0 | on | off }

Specifies whether to center the dialog window in the desktop. The default is yes.

dialogHide:{ yes | no | 1 | 0 | on | off }

Specifies whether the dialog window is hidden when printing or using print preview. This feature is only available when a dialog box is opened from a trusted application. The default is no.

edge:{ sunken | raised }

Specifies the edge style of the dialog window. The default is raised.

help:{ yes | no | 1 | 0 | on | off }

Specifies whether the dialog window displays the context-sensitive Help icon. The default is yes.

resizable:{ yes | no | 1 | 0 | on | off }

Specifies whether the dialog window has fixed dimensions. The default is no.

scroll:{ yes | no | 1 | 0 | on | off }

Specifies whether the dialog window displays scrollbars. The default is yes.

status:{ yes | no | 1 | 0 | on | off }

Specifies whether the dialog window displays a status bar. The default is yes for untrusted dialog windows and no for trusted dialog windows.

unadorned:{ yes | no | 1 | 0 | on | off }

Specifies whether the dialog window displays the border window chrome. This feature is only available when a dialog box is opened from a trusted application. The default is no.

pvarArgOut [out]

Type: VARIANT

A pointer to 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 set to NULL.

punkHost [out]

Type: IUnknown

A pointer to an IUnknown interface for the hosting application. This parameter can be set to NULL.

Return value

Type: HRESULT

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

Remarks

Dialog boxes created with this method are trusted and do not have a user interface that identifies them as Windows Internet Explorer dialog boxes. The name on the title bar for the dialog box is taken from the title element in the HTML source specified by pMk. If there is no title element, the title bar name is blank.

See IHTMLWindow2::showModalDialog for additional information on modal dialog boxes and the default unit of measure used.

You can use CreateURLMonikerEx or CreateURLMoniker to obtain an IMoniker interface pointer for the URL of the HTML source of the dialog box.

Examples

This example obtains an IHostDialogHelper interface pointer using CoCreateInstance and calls ShowHTMLDialog. Error handling has been omitted for clarity.


IHostDialogHelper* pHDH;
IMoniker* pUrlMoniker;
BSTR bstrOptions = SysAllocString(L"dialogHeight:30;dialogWidth:40");
BSTR bstrPath = SysAllocString(L"c:\\dummy.htm");

CreateURLMoniker(NULL, bstrPath, &pUrlMoniker);

CoCreateInstance(CLSID_HostDialogHelper,
                 NULL,
                 CLSCTX_INPROC,
                 IID_IHostDialogHelper,
                 (void**)&pHDH);

pHDH->ShowHTMLDialog(NULL,
                     pUrlMoniker,
                     NULL,
                     bstrOptions,
                     NULL,
                     NULL);

SysFreeString(bstrPath);
SysFreeString(bstrOptions);
pUrlMoniker->Release();
pHDH->Release();


 

 

Show: