CDHtmlDialog Class

 

For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

Is used to create dialog boxes that use HTML rather than dialog resources to implement their user interface.

class CDHtmlDialog : public CDialog, public CDHtmlEventSink  

Public Constructors

NameDescription
CDHtmlDialog::CDHtmlDialogConstructs a CDHtmlDialog object.
CDHtmlDialog::~CDHtmlDialogDestroys a CDHtmlDialog object.

Public Methods

NameDescription
CDHtmlDialog::CanAccessExternalOverridable that is called as an access check to see whether scripting objects on the loaded page can access the external dispatch of the control site. Checks to make sure the dispatch is either safe for scripting or the current zone allows for objects that are not safe for scripting.
CDHtmlDialog::CreateControlSiteOverridable used to create a control site instance to host the WebBrowser control on the dialog.
CDHtmlDialog::DDX_DHtml_AxControlExchanges data between a member variable and the property value of an ActiveX control on an HTML page.
CDHtmlDialog::DDX_DHtml_CheckBoxExchanges data between a member variable and a check box on an HTML page.
CDHtmlDialog::DDX_DHtml_ElementTextExchanges data between a member variable and any HTML element property on an HTML page.
CDHtmlDialog::DDX_DHtml_RadioExchanges data between a member variable and a radio button on an HTML page.
CDHtmlDialog::DDX_DHtml_SelectIndexGets or sets the index of a list box on an HTML page.
CDHtmlDialog::DDX_DHtml_SelectStringGets or sets the display text of a list box entry (based on the current index) on an HTML page.
CDHtmlDialog::DDX_DHtml_SelectValueGets or sets the value of a list box entry (based on the current index) on an HTML page.
CDHtmlDialog::DestroyModelessDestroys a modeless dialog box.
CDHtmlDialog::EnableModelessEnables modeless dialog boxes.
CDHtmlDialog::FilterDataObjectAllows the dialog to filter clipboard data objects created by the hosted browser.
CDHtmlDialog::GetControlDispatchRetrieves the IDispatch interface on an ActiveX control embedded in the HTML document.
CDHtmlDialog::GetControlPropertyRetrieves the requested property of the specified ActiveX control.
CDHtmlDialog::GetCurrentUrlRetrieves the Uniform Resource Locator (URL) associated with the current document.
CDHtmlDialog::GetDHtmlDocumentRetrieves the IHTMLDocument2 interface on the currently loaded HTML document.
CDHtmlDialog::GetDropTargetCalled by the contained WebBrowser control when it is being used as a drop target to allow the dialog to supply an alternative IDropTarget.
CDHtmlDialog::GetElementGets an interface on an HTML element.
CDHtmlDialog::GetElementHtmlRetrieves the innerHTML property of an HTML element.
CDHtmlDialog::GetElementInterfaceRetrieves the requested interface pointer from an HTML element.
CDHtmlDialog::GetElementPropertyRetrieves the value of an HTML element's property.
CDHtmlDialog::GetElementTextRetrieves the innerText property of an HTML element.
CDHtmlDialog::GetEventGets the IHTMLEventObj pointer to the current event object.
CDHtmlDialog::GetExternalGets the host's IDispatch interface.
CDHtmlDialog::GetHostInfoRetrieves the host's UI capabilities.
CDHtmlDialog::GetOptionKeyPathRetrieves the registry key under which user preferences are stored.
CDHtmlDialog::HideUIHides the host's UI.
CDHtmlDialog::IsExternalDispatchSafeIndicates whether the host's IDispatch interface is safe for scripting.
CDHtmlDialog::LoadFromResourceLoads the specified resource into the WebBrowser control.
CDHtmlDialog::NavigateNavigates to the specified URL.
CDHtmlDialog::OnBeforeNavigateCalled by the framework before a navigation event is fired.
CDHtmlDialog::OnDocumentCompleteCalled by the framework to notify an application when a document has reached the READYSTATE_COMPLETE state.
CDHtmlDialog::OnDocWindowActivateCalled by the framework when the document window is activated or deactivated.
CDHtmlDialog::OnFrameWindowActivateCalled by the framework when the frame window is activated or deactivated.
CDHtmlDialog::OnInitDialogCalled in response to the WM_INITDIALOG message.
CDHtmlDialog::OnNavigateCompleteCalled by the framework after a navigation event is completed.
CDHtmlDialog::ResizeBorderAlerts the object that it needs to resize its border space.
CDHtmlDialog::SetControlPropertySets the property of an ActiveX control to a new value.
CDHtmlDialog::SetElementHtmlSets the innerHTML property of an HTML element.
CDHtmlDialog::SetElementPropertySets a property of an HTML element.
CDHtmlDialog::SetElementTextSets the innerText property of an HTML element.
CDHtmlDialog::SetExternalDispatchSets the host's IDispatch interface.
CDHtmlDialog::SetHostFlagsSets the host's UI flags.
CDHtmlDialog::ShowContextMenuCalled when a context menu is about to be displayed.
CDHtmlDialog::ShowUIShows the host's UI.
CDHtmlDialog::TranslateAcceleratorCalled to process menu accelerator-key messages.
CDHtmlDialog::TranslateUrlCalled to modify the URL to be loaded.
CDHtmlDialog::UpdateUICalled to notify the host that the command state has changed.

Public Data Members

NameDescription
CDHtmlDialog::m_bUseHtmlTitleIndicates whether to use the HTML document's title as the dialog caption.
CDHtmlDialog::m_nHtmlResIDResource ID of HTML resource to be displayed.
CDHtmlDialog::m_pBrowserAppA pointer to a Web browser application.
CDHtmlDialog::m_spHtmlDocA pointer to an HTML document.
CDHtmlDialog::m_strCurrentUrlThe current URL.
CDHtmlDialog::m_szHtmlResIDString version of the HTML resource ID.

CDHtmlDialog can load the HTML to be displayed from either an HTML resource or a URL.

CDHtmlDialog can also do data exchange with HTML controls and handle events from HTML controls, such as button clicks.

CObject

CDHtmlSinkHandlerBase2

CDHtmlSinkHandlerBase1

CCmdTarget

CDHtmlSinkHandler

CWnd

CDHtmlEventSink

CDialog

CDHtmlDialog

Header: afxdhtml.h

The DDX_DHtml helper macros allow easy access to the commonly used properties of controls on an HTML page.

Data Exchange Macros

DDX_DHtml_ElementValueSets or retrieves the Value property from the selected control.
DDX_DHtml_ElementInnerTextSets or retrieves the text between the start and end tags of the current element.
DDX_DHtml_ElementInnerHtmlSets or retrieves the HTML between the start and end tags of the current element.
DDX_DHtml_Anchor_HrefSets or retrieves the destination URL or anchor point.
DDX_DHtml_Anchor_TargetSets or retrieves the target window or frame.
DDX_DHtml_Img_SrcSets or retrieves the name of an image or a video clip in the document.
DDX_DHtml_Frame_SrcSets or retrieves the URL of the associated frame.
DDX_DHtml_IFrame_SrcSets or retrieves the URL of the associated frame.

Overridable that is called as an access check to see whether scripting objects on the loaded page can access the external dispatch of the control site. Checks to make sure the dispatch is either safe for scripting or the current zone allows for objects that are not safe for scripting.

virtual BOOL CanAccessExternal();

Return Value

Nonzero if successful; otherwise 0.

Constructs a resource-based dynamic HTML dialog box.

CDHtmlDialog();

 
CDHtmlDialog(
    LPCTSTR lpszTemplateName,  
    LPCTSTR szHtmlResID,  
    CWnd *pParentWnd = NULL);

 
CDHtmlDialog(
    UINT nIDTemplate,  
    UINT nHtmlResID = 0,  
    CWnd *pParentWnd = NULL);

Parameters

lpszTemplateName
The null-terminated string that is the name of a dialog-box template resource.

szHtmlResID
The null-terminated string that is the name of an HTML resource.

pParentWnd
A pointer to the parent or owner window object (of type CWnd) to which the dialog object belongs. If it is NULL, the dialog object's parent window is set to the main application window.

nIDTemplate
Contains the ID number of a dialog-box template resource.

nHtmlResID
Contains the ID number of an HTML resource.

Remarks

The second form of the constructor provides access to the dialog resource through the template name. The third form of the constructor provides access to the dialog resource through the ID of the resource template. Usually, the ID begins with the IDD_ prefix.

Destroys a CDHtmlDialog object.

virtual ~CDHtmlDialog();

Remarks

The CWnd::DestroyWindow member function must be used to destroy modeless dialog boxes that are created by CDialog::Create.

Overridable used to create a control site instance to host the WebBrowser control on the dialog.

virtual BOOL CreateControlSite(
    COleControlContainer* pContainer,  
    COleControlSite** ppSite,  
    UINT /* nID */,  
    REFCLSID /* clsid */);

Parameters

pContainer
A pointer to the COleControlContainer object

ppSite
A pointer to a pointer to a COleControlSite.

Return Value

Nonzero if successful; otherwise 0.

Remarks

You can override this member function to return an instance of your own control site class.

Exchanges data between a member variable and the property value of an ActiveX control on an HTML page.

void DDX_DHtml_AxControl(
    CDataExchange* pDX,  
    LPCTSTR szId,  
    DISPID dispid,  
    VARIANT& var);

 
void DDX_DHtml_AxControl(
    CDataExchange* pDX,  
    LPCTSTR szId,  
    LPCTSTR szPropName,  
    VARIANT& var);

Parameters

pDX
A pointer to a CDataExchange object.

szId
The value of the object tag's ID parameter in the HTML source for the ActiveX control.

dispid
The dispatch ID of the property with which you want to exchange data.

szPropName
The name of the property.

var
The data member, of type VARIANT, COleVariant, or CComVariant, that holds the value exchanged with the ActiveX control property.

Example

   // COleVariant m_varSliderValue;
   DDX_DHtml_AxControl(pDX, _T("slider1"), 0x0b /* Value */, m_varSliderValue );

Exchanges data between a member variable and a check box on an HTML page.

void DDX_DHtml_CheckBox(
    CDataExchange* pDX,  
    LPCTSTR szId,  
    int& value);

Parameters

pDX
A pointer to a CDataExchange object.

szId
The value that you specified for the HTML control's ID parameter.

value
The value being exchanged.

Example

   // int m_nItalic;
   DDX_DHtml_CheckBox(pDX, L"italic", m_nItalic);

Exchanges data between a member variable and any HTML element property on an HTML page.

void DDX_DHtml_ElementText(
    CDataExchange* pDX,  
    LPCTSTR szId,  
    DISPID dispid,  
    CString& value);

 
void DDX_DHtml_ElementText(
    CDataExchange* pDX,  
    LPCTSTR szId,  
    DISPID dispid,  
    short& value);

 
void DDX_DHtml_ElementText(
    CDataExchange* pDX,  
    LPCTSTR szId,  
    DISPID dispid,  
    int& value);

 
void DDX_DHtml_ElementText(
    CDataExchange* pDX,  
    LPCTSTR szId,  
    DISPID dispid,  
    long& value);

 
void DDX_DHtml_ElementText(
    CDataExchange* pDX,  
    LPCTSTR szId,  
    DISPID dispid,  
    DWORD& value);

 
void DDX_DHtml_ElementText(
    CDataExchange* pDX,  
    LPCTSTR szId,  
    DISPID dispid,  
    float& value);

 
void DDX_DHtml_ElementText(
    CDataExchange* pDX,  
    LPCTSTR szId,  
    DISPID dispid,  
    double& value);

Parameters

pDX
A pointer to a CDataExchange object.

szId
The value that you specified for the HTML control's ID parameter.

dispid
The dispatch ID of the HTML element with which you want to exchange data.

value
The value being exchanged.

Exchanges data between a member variable and a radio button on an HTML page.

void DDX_DHtml_Radio(
    CDataExchange* pDX,  
    LPCTSTR szId,  
    long& value);

Parameters

pDX
A pointer to a CDataExchange object.

szId
The value that you specified for the HTML control's ID parameter.

value
The value being exchanged.

Gets or sets the index of a list box on an HTML page.

void DDX_DHtml_SelectIndex(
    CDataExchange* pDX,  
    LPCTSTR szId,  
    long& value);

Parameters

pDX
A pointer to a CDataExchange object.

szId
The value that you specified for the HTML control's id parameter.

value
The value being exchanged.

Gets or sets the display text of a list box entry (based on the current index) on an HTML page.

void DDX_DHtml_SelectString(
    CDataExchange* pDX,  
    LPCTSTR szId,  
    CString& value);

Parameters

pDX
A pointer to a CDataExchange object.

szId
The value that you specified for the HTML control's ID parameter.

value
The value being exchanged.

Gets or sets the value of a list box entry (based on the current index) on an HTML page.

void DDX_DHtml_SelectValue(
    CDataExchange* pDX,  
    LPCTSTR szId,  
    CString& value);

Parameters

pDX
A pointer to a CDataExchange object.

szId
The value that you specified for the HTML control's ID parameter.

value
The value being exchanged.

Example

   // CString m_strBlurDir;
   DDX_DHtml_SelectValue(pDX, L"blurDir", m_strBlurDir);

Detaches a modeless dialog box from the CDHtmlDialog object and destroys the object.

void DestroyModeless();

Enables modeless dialog boxes.

STDMETHOD(EnableModeless)(BOOL fEnable);

Parameters

fEnable
See fEnable in IDocHostUIHandler::EnableModeless in the Windows SDK.

Return Value

Returns E_NOTIMPL.

Remarks

This member function is CDHtmlDialog's implementation of IDocHostUIHandler::EnableModeless, as described in the Windows SDK.

Allows the dialog to filter clipboard data objects created by the hosted browser.

STDMETHOD(FilterDataObject)(
    IDataObject* pDO,  
    IDataObject** ppDORet);

Parameters

pDO
See pDO in IDocHostUIHandler::FilterDataObject in the Windows SDK.

ppDORet
See ppDORet in IDocHostUIHandler::FilterDataObject in the Windows SDK.

Return Value

Returns S_FALSE.

Remarks

This member function is CDHtmlDialog's implementation of IDocHostUIHandler::FilterDataObject, as described in the Windows SDK.

Retrieves the IDispatch interface on an ActiveX control embedded in the HTML document returned by GetDHtmlDocument.

HRESULT GetControlDispatch(
    LPCTSTR szId,  
    IDispatch** ppdisp);

Parameters

szId
The HTML ID of an ActiveX control.

ppdisp
The IDispatch interface of the control if found in the Web page.

Return Value

A standard HRESULT value.

Retrieves the requested property of the specified ActiveX control.

VARIANT GetControlProperty(
    LPCTSTR szId,  
    LPCTSTR szPropName);

 
VARIANT GetControlProperty(
    LPCTSTR szId,  
    DISPID dispid);

 
VARIANT GetControlProperty(
    IDispatch* pdispControl,  
    DISPID dispid);

Parameters

szId
The HTML ID of an ActiveX control.

szPropName
The name of a property in the default locale of the current user.

pdispControl
The IDispatch pointer of an ActiveX control.

dispid
The dispatch ID of a property.

Return Value

A variant containing the requested property or an empty variant if the control or property could not be found.

Remarks

The overloads are listed from least efficient at the top to most efficient at the bottom.

Retrieves the Uniform Resource Locator (URL) associated with the current document.

void GetCurrentUrl(CString& szUrl);

Parameters

szUrl
A CString object containing the URL to retrieve.

Retrieves the IHTMLDocument2 interface on the currently loaded HTML document.

HRESULT GetDHtmlDocument(IHTMLDocument2 **pphtmlDoc);

Parameters

**pphtmlDoc
A pointer to a pointer to an HTML document.

Return Value

A standard HRESULT. Returns S_OK if successful.

Called by the contained WebBrowser control when it is being used as a drop target to allow the dialog to supply an alternative IDropTarget.

STDMETHOD(GetDropTarget)(
    IDropTarget* pDropTarget,  
    IDropTarget** ppDropTarget);

Parameters

pDropTarget
See pDropTarget in IDocHostUIHandler::GetDropTarget in the Windows SDK.

ppDropTarget
See ppDropTarget in IDocHostUIHandler::GetDropTarget in the Windows SDK.

Return Value

Returns E_NOTIMPL.

Remarks

This member function is CDHtmlDialog's implementation of IDocHostUIHandler::GetDropTarget, as described in the Windows SDK.

Returns an interface on the HTML element specified by szElementId.

HRESULT GetElement(
    LPCTSTR szElementId,  
    IDispatch** ppdisp,  
    BOOL* pbCollection = NULL);

 
HRESULT GetElement(
    LPCTSTR szElementId,  
    IHTMLElement** pphtmlElement);

Parameters

szElementId
The ID of an HTML element.

ppdisp
An IDispatch pointer to the requested element or collection of elements.

pbCollection
A BOOL indicating whether the object represented by ppdisp is a single element or a collection of elements.

pphtmlElement
An IHTMLElement pointer to the requested element.

Return Value

A standard HRESULT value.

Remarks

Use the first overload if you need to handle conditions in which there may be more than one element with the specified ID. You can use the last parameter to find out whether the returned interface pointer is to a collection or a single item. If the interface pointer is on a collection, you can query for the IHTMLElementCollection and use its item property to refer to the elements by ordinal position.

The second overload will fail if there is more than one element with the same ID in the page.

Retrieves the innerHTML property of the HTML element identified by szElementId.

BSTR GetElementHtml(LPCTSTR szElementId);

Parameters

szElementId
The ID of an HTML element.

Return Value

The innerHTML property of the HTML element identified by szElementId or NULL if the element could not be found.

Retrieves the requested interface pointer from the HTML element identified by szElementId.

template <class Q> HRESULT GetElementInterface(
    LPCTSTR szElementId,  
    Q** ppvObj);

 
HRESULT GetElementInterface(
    LPCTSTR szElementId,  
    REFIID riid,  
    void** ppvObj);

Parameters

szElementId
The ID of an HTML element.

ppvObj
Address of a pointer that will be filled with the requested interface pointer if the element is found and the query succeeds.

riid
The interface ID (IID) of the requested interface.

Return Value

A standard HRESULT value.

Example

   CComPtr<IHTMLInputButtonElement> spBtn1;
   CComPtr<IHTMLInputButtonElement> spBtn2;
   HRESULT hr = S_OK;

   // Use the template overload
   hr = GetElementInterface(L"Button1", &spBtn1);

   // Use the nontemplate overload
   hr = GetElementInterface(L"Button1", IID_IHTMLInputButtonElement, 
      reinterpret_cast<void**>(&spBtn2));

Retrieves the value of the property identified by dispid from the HTML element identified by szElementId.

VARIANT GetElementProperty(
    LPCTSTR szElementId,  
    DISPID dispid);

Parameters

szElementId
The ID of an HTML element.

dispid
The dispatch ID of a property.

Return Value

The value of the property or an empty variant if the property or element could not be found.

Retrieves the innerText property of the HTML element identified by szElementId.

BSTR GetElementText(LPCTSTR szElementId);

Parameters

szElementId
The ID of an HTML element.

Return Value

The innerText property of the HTML element identified by szElementId or NULL if the property or element could not be found.

Returns the IHTMLEventObj pointer to the current event object.

HRESULT GetEvent(IHTMLEventObj** ppEventObj);

Parameters

ppEventObj
Address of a pointer that will be filled with the IHTMLEventObj interface pointer.

Return Value

A standard HRESULT value.

Remarks

This function should only be called from within a DHTML event handler.

Gets the host's IDispatch interface.

STDMETHOD(GetExternal)(IDispatch** ppDispatch);

Parameters

ppDispatch
See ppDispatch in IDocHostUIHandler::GetExternal in the Windows SDK.

Return Value

Returns S_OK on success or E_NOTIMPL on failure.

Remarks

This member function is CDHtmlDialog's implementation of IDocHostUIHandler::GetExternal, as described in the Windows SDK.

Retrieves the host's UI capabilities.

STDMETHOD(GetHostInfo)(DOCHOSTUIINFO* pInfo);

Parameters

pInfo
See pInfo in IDocHostUIHandler::GetHostInfo in the Windows SDK.

Return Value

Returns S_OK.

Remarks

This member function is CDHtmlDialog's implementation of IDocHostUIHandler::GetHostInfo, as described in the Windows SDK.

Retrieves the registry key under which user preferences are stored.

STDMETHOD(GetOptionKeyPath)(
    LPOLESTR* pchKey,  
    DWORD dw);

Parameters

pchKey
See pchKey in IDocHostUIHandler::GetOptionKeyPath in the Windows SDK.

dw
See dw in IDocHostUIHandler::GetOptionKeyPath in the Windows SDK.

Return Value

Returns E_NOTIMPL.

Remarks

This member function is CDHtmlDialog's implementation of IDocHostUIHandler::GetOptionKeyPath, as described in the Windows SDK.

Hides the host's UI.

STDMETHOD(HideUI)(void);

Return Value

Returns E_NOTIMPL.

Remarks

This member function is CDHtmlDialog's implementation of IDocHostUIHandler::HideUI, as described in the Windows SDK.

Indicates whether the host's IDispatch interface is safe for scripting.

virtual BOOL IsExternalDispatchSafe();

Return Value

Returns FALSE.

Loads the specified resource into the WebBrowser control in the DHTML dialog.

BOOL LoadFromResource(LPCTSTR lpszResource);

 
BOOL LoadFromResource(UINT nRes);

Parameters

lpszResource
A pointer to a string containing the name of the resource to load.

nRes
The ID of the resource to load.

Return Value

TRUE if successful; otherwise FALSE.

Indicates whether to use the HTML document's title as the dialog caption.

BOOL m_bUseHtmlTitle;  

Remarks

If m_ bUseHtmlTitle is true, the dialog caption is set equal to the title of the HTML document; otherwise, the caption in the dialog resource is used.

Resource ID of HTML resource to be displayed.

UINT m_nHtmlResID;  

Example

   CDHtmlDialog mydialog(IDD_MYDHTMLDLG);
   mydialog.m_nHtmlResID = IDR_HTML_MYDHTMLDLG;
   mydialog.DoModal();

A pointer to a Web browser application.

CComPtr <IWebBrowser2> m_pBrowserApp;  

A pointer to an HTML document.

CComPtr<IHTMLDocument2> m_spHtmlDoc;  

The current URL.

CString m_strCurrentUrl;  

String version of the HTML resource ID.

LPTSTR m_szHtmlResID;  

Example

   CDHtmlDialog mydialog(IDD_MYDHTMLDLG);
   TCHAR szResID[] = _T("HTML_PAGE");
   mydialog.m_szHtmlResID = szResID;
   mydialog.DoModal( );

Navigates to the resource identified by the URL that is specified by lpszURL.

void Navigate(
    LPCTSTR lpszURL,  
    DWORD dwFlags = 0,  
    LPCTSTR lpszTargetFrameName = NULL,  
    LPCTSTR lpszHeaders = NULL,  
    LPVOID lpvPostData = NULL,  
    DWORD dwPostDataLen = 0);

Parameters

lpszURL
A pointer to a string containing the URL to be targeted.

dwFlags
The flags of a variable that specifies whether to add the resource to the history list, whether to read to the cache or write from the cache, and whether to display the resource in a new window. The variable can be a combination of the values defined by the BrowserNavConstants enumeration.

lpszTargetFrameName
A pointer to a string that contains the name of the frame in which to display the resource.

lpszHeaders
A pointer to a value that specifies the HTTP headers to send to the server. These headers are added to the default Internet Explorer headers. The headers can specify such information as the action required of the server, the type of data being passed to the server, or a status code. This parameter is ignored if the URL is not an HTTP URL.

lpvPostData
A pointer to the data to send with the HTTP POST transaction. For example, the POST transaction is used to send data gathered by an HTML form. If this parameter does not specify any post data, Navigate issues an HTTP GET transaction. This parameter is ignored if the URL is not an HTTP URL.

dwPostDataLen
Data to send with the HTTP POST transaction. For example, the POST transaction is used to send data gathered by an HTML form. If this parameter does not specify any post data, Navigate issues an HTTP GET transaction. This parameter is ignored if URL is not an HTTP URL.

Called by the framework to cause an event to fire before a navigation occurs.

virtual void OnBeforeNavigate(
    LPDISPATCH pDisp,  
    LPCTSTR szUrl);

Parameters

pDisp
A pointer to an IDispatch object.

szUrl
A pointer to a string containing the URL to navigate to.

Called by the framework to notify an application when a document has achieved the READYSTATE_COMPLETE state.

virtual void OnDocumentComplete(
    LPDISPATCH pDisp,  
    LPCTSTR szUrl);

Parameters

pDisp
A pointer to an IDispatch object.

szUrl
A pointer to a string containing the URL that was navigated to.

Called by the framework when the document window is activated or deactivated.

STDMETHOD(OnDocWindowActivate)(BOOL fActivate);

Parameters

fActivate
See fActivate in IDocHostUIHandler::OnDocWindowActivate in the Windows SDK.

Return Value

Returns E_NOTIMPL.

Remarks

This member function is CDHtmlDialog's implemention of IDocHostUIHandler::OnDocWindowActivate, as described in the Windows SDK.

Called by the framework when the frame window is activated or deactivated.

STDMETHOD(OnFrameWindowActivate)(BOOL fActivate);

Parameters

fActivate
See fActivate in IDocHostUIHandler::OnFrameWindowActivate in the Windows SDK.

Return Value

Returns E_NOTIMPL.

Remarks

This member function is CDHtmlDialog's implementation of IDocHostUIHandler::OnFrameWindowActivate, as described in the Windows SDK.

Called in response to the WM_INITDIALOG message.

virtual BOOL OnInitDialog();

Return Value

The default implementation returns TRUE.

Remarks

This message is sent to the dialog box during the Create, CreateIndirect, or DoModal calls, which occur immediately before the dialog box is displayed.

Override this member function if you need to perform special processing when the dialog box is initialized. In the overridden version, first call the base class OnInitDialog but disregard its return value. You will normally return TRUE from your overridden member function.

Windows calls the OnInitDialog function through the standard global dialog-box procedure common to all Microsoft Foundation Class Library dialog boxes, rather than through your message map, so you do not need a message-map entry for this member function.

Called by the framework after navigation to the specified URL is completed.

virtual void OnNavigateComplete(
    LPDISPATCH pDisp,  
    LPCTSTR szUrl);

Parameters

pDisp
A pointer to an IDispatch object.

szUrl
A pointer to a string containing the URL that was navigated to.

Alerts the object that it needs to resize its border space.

STDMETHOD(ResizeBorder)(
    LPCRECT prcBorder,  
    IOleInPlaceUIWindow* pUIWindow,  
    BOOL fRameWindow);

Parameters

prcBorder
See prcBorder in IDocHostUIHandler::ResizeBorder in the Windows SDK.

pUIWindow
See pUIWindow in IDocHostUIHandler::ResizeBorder in the Windows SDK.

fFrameWindow
See fFrameWindow in IDocHostUIHandler::ResizeBorder in the Windows SDK.

Return Value

Returns E_NOTIMPL.

Sets the property of an ActiveX control to a new value.

void SetControlProperty(
    LPCTSTR szElementId,  
    DISPID dispid,  
    VARIANT* pVar);

 
void SetControlProperty(
    IDispatch* pdispControl,  
    DISPID dispid,  
    VARIANT* pVar);

 
void SetControlProperty(
    LPCTSTR szElementId,  
    LPCTSTR szPropName,  
    VARIANT* pVar);

Parameters

szElementId
The HTML ID of an ActiveX control.

dispid
The dispatch ID of the property to set.

pVar
Pointer to a VARIANT containing the new property value.

pdispControl
Pointer to an ActiveX control's IDispatch interface.

szPropName
String containing the name of the property to set.

Sets the innerHTML property of an HTML element.

void SetElementHtml(
    LPCTSTR szElementId,  
    BSTR bstrText);

 
void SetElementHtml(
    IUnknown* punkElem,  
    BSTR bstrText);

Parameters

szElementId
The ID of an HTML element.

bstrText
The new value of the innerHTML property.

punkElem
The IUnknown pointer of an HTML element.

Sets a property of an HTML element.

void SetElementProperty(
    LPCTSTR szElementId,  
    DISPID dispid,  
    VARIANT* pVar);

Parameters

szElementId
The ID of an HTML element.

dispid
The dispatch ID of the property to set.

pVar
The new value of the property.

Sets the innerText property of an HTML element.

void SetElementText(
    LPCTSTR szElementId,  
    BSTR bstrText);

 
void SetElementText(
    IUnknown* punkElem,  
    BSTR bstrText);

Parameters

szElementId
The ID of an HTML element.

bstrText
The new value of the innerText property.

punkElem
The IUnknown pointer of an HTML element.

Sets the host's IDispatch interface.

void SetExternalDispatch(IDispatch* pdispExternal);

Parameters

pdispExternal
The new IDispatch interface.

Sets the host UI flags.

void SetHostFlags(DWORD dwFlags);

Parameters

dwFlags
For possible values, see DOCHOSTUIFLAG in the Windows SDK.

Called when a context menu is about to be displayed.

STDMETHOD(ShowContextMenu)(
    DWORD dwID,  
    POINT* ppt,  
    IUnknown* pcmdtReserved,  
    IDispatch* pdispReserved);

Parameters

dwID
See dwID in IDocHostUIHandler::ShowContextMenu in the Windows SDK.

ppt
See ppt in IDocHostUIHandler::ShowContextMenu in the Windows SDK.

pcmdtReserved
See pcmdtReserved in IDocHostUIHandler::ShowContextMenu in the Windows SDK.

pdispReserved
See pdispReserved in IDocHostUIHandler::ShowContextMenu in the Windows SDK.

Return Value

Returns S_FALSE.

Remarks

This member function is CDHtmlDialog's implementation of IDocHostUIHandler::ShowContextMenu, as described in the Windows SDK.

Shows the host's UI.

STDMETHOD(ShowUI)(
    DWORD dwID,  
    IOleInPlaceActiveObject* pActiveObject,  
    IOleCommandTarget* pCommandTarget,  
    IOleInPlaceFrame* pFrame,  
    IOleInPlaceUIWindow* pDoc);

Parameters

dwID
See dwID in IDocHostUIHandler::ShowUI in the Windows SDK.

pActiveObject
See d pActiveObject in IDocHostUIHandler::ShowUI in the Windows SDK.

pCommandTarget
See pCommandTarget in IDocHostUIHandler::ShowUI in the Windows SDK.

pFrame
See pFrame in IDocHostUIHandler::ShowUI in the Windows SDK.

pDoc
See pDoc in IDocHostUIHandler::ShowUI in the Windows SDK.

Return Value

Returns S_FALSE.

Remarks

This member function is CDHtmlDialog's implementation of IDocHostUIHandler::ShowUI, as described in the Windows SDK.

Called to process menu accelerator-key messages.

STDMETHOD(TranslateAccelerator)(
    LPMSG lpMsg,  
    const GUID* pguidCmdGroup,  
    DWORD nCmdID);

Parameters

lpMsg
See lpMsg in IDocHostUIHandler::TranslateAccelerator in the Windows SDK.

pguidCmdGroup
See pguidCmdGroup in IDocHostUIHandler::TranslateAccelerator in the Windows SDK.

nCmdID
See nCmdID in IDocHostUIHandler::TranslateAccelerator in the Windows SDK.

Return Value

Returns S_FALSE.

Remarks

This member function is CDHtmlDialog's implementation of IDocHostUIHandler::TranslateAccelerator, as described in the Windows SDK.

Called to modify the URL to be loaded.

STDMETHOD(TranslateUrl)(
    DWORD dwTranslate,  
    OLECHAR* pchURLIn,  
    OLECHAR** ppchURLOut);

Parameters

dwTranslate
See dwTranslate in IDocHostUIHandler::TranslateUrl in the Windows SDK.

pchURLIn
See pchURLIn in IDocHostUIHandler::TranslateUrl in the Windows SDK.

ppchURLOut
See ppchURLOut in IDocHostUIHandler::TranslateUrl in the Windows SDK.

Return Value

Returns S_FALSE.

Remarks

This member function is CDHtmlDialog's implementation of IDocHostUIHandler::TranslateUrl, as described in the Windows SDK.

Called to notify the host that the command state has changed.

STDMETHOD(UpdateUI)(void);

Return Value

Returns E_NOTIMPL.

Remarks

This member function is CDHtmlDialog's implementation of IDocHostUIHandler::UpdateUI, as described in the Windows SDK.

MFC Sample DHtmlExplore
DDX_DHtml Helper Macros
Hierarchy Chart

Show: