description | title | ms.date | f1_keywords | helpviewer_keywords | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Learn more about: CDHtmlDialog Class |
CDHtmlDialog Class |
03/27/2019 |
|
|
Is used to create dialog boxes that use HTML rather than dialog resources to implement their user interface.
class CDHtmlDialog : public CDialog, public CDHtmlEventSink
Name | Description |
---|---|
CDHtmlDialog::CDHtmlDialog |
Constructs a CDHtmlDialog object. |
CDHtmlDialog::~CDHtmlDialog |
Destroys a CDHtmlDialog object. |
Name | Description |
---|---|
CDHtmlDialog::CanAccessExternal |
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 aren't safe for scripting. |
CDHtmlDialog::CreateControlSite |
Overridable used to create a control site instance to host the WebBrowser control on the dialog. |
CDHtmlDialog::DDX_DHtml_AxControl |
Exchanges data between a member variable and the property value of an ActiveX control on an HTML page. |
CDHtmlDialog::DDX_DHtml_CheckBox |
Exchanges data between a member variable and a check box on an HTML page. |
CDHtmlDialog::DDX_DHtml_ElementText |
Exchanges data between a member variable and any HTML element property on an HTML page. |
CDHtmlDialog::DDX_DHtml_Radio |
Exchanges data between a member variable and a radio button on an HTML page. |
CDHtmlDialog::DDX_DHtml_SelectIndex |
Gets or sets the index of a list box on an HTML page. |
CDHtmlDialog::DDX_DHtml_SelectString |
Gets or sets the display text of a list box entry (based on the current index) on an HTML page. |
CDHtmlDialog::DDX_DHtml_SelectValue |
Gets or sets the value of a list box entry (based on the current index) on an HTML page. |
CDHtmlDialog::DestroyModeless |
Destroys a modeless dialog box. |
CDHtmlDialog::EnableModeless |
Enables modeless dialog boxes. |
CDHtmlDialog::FilterDataObject |
Allows the dialog to filter clipboard data objects created by the hosted browser. |
CDHtmlDialog::GetControlDispatch |
Retrieves the IDispatch interface on an ActiveX control embedded in the HTML document. |
CDHtmlDialog::GetControlProperty |
Retrieves the requested property of the specified ActiveX control. |
CDHtmlDialog::GetCurrentUrl |
Retrieves the Uniform Resource Locator (URL) associated with the current document. |
CDHtmlDialog::GetDHtmlDocument |
Retrieves the IHTMLDocument2 interface on the currently loaded HTML document. |
CDHtmlDialog::GetDropTarget |
Called by the contained WebBrowser control when it's being used as a drop target to allow the dialog to supply an alternative IDropTarget . |
CDHtmlDialog::GetElement |
Gets an interface on an HTML element. |
CDHtmlDialog::GetElementHtml |
Retrieves the innerHTML property of an HTML element. |
CDHtmlDialog::GetElementInterface |
Retrieves the requested interface pointer from an HTML element. |
CDHtmlDialog::GetElementProperty |
Retrieves the value of an HTML element's property. |
CDHtmlDialog::GetElementText |
Retrieves the innerText property of an HTML element. |
CDHtmlDialog::GetEvent |
Gets the IHTMLEventObj pointer to the current event object. |
CDHtmlDialog::GetExternal |
Gets the host's IDispatch interface. |
CDHtmlDialog::GetHostInfo |
Retrieves the host's UI capabilities. |
CDHtmlDialog::GetOptionKeyPath |
Retrieves the registry key under which user preferences are stored. |
CDHtmlDialog::HideUI |
Hides the host's UI. |
CDHtmlDialog::IsExternalDispatchSafe |
Indicates whether the host's IDispatch interface is safe for scripting. |
CDHtmlDialog::LoadFromResource |
Loads the specified resource into the WebBrowser control. |
CDHtmlDialog::Navigate |
Navigates to the specified URL. |
CDHtmlDialog::OnBeforeNavigate |
Called by the framework before a navigation event is fired. |
CDHtmlDialog::OnDocumentComplete |
Called by the framework to notify an application when a document has reached the READYSTATE_COMPLETE state. |
CDHtmlDialog::OnDocWindowActivate |
Called by the framework when the document window is activated or deactivated. |
CDHtmlDialog::OnFrameWindowActivate |
Called by the framework when the frame window is activated or deactivated. |
CDHtmlDialog::OnInitDialog |
Called in response to the WM_INITDIALOG message. |
CDHtmlDialog::OnNavigateComplete |
Called by the framework after a navigation event is completed. |
CDHtmlDialog::ResizeBorder |
Alerts the object that it needs to resize its border space. |
CDHtmlDialog::SetControlProperty |
Sets the property of an ActiveX control to a new value. |
CDHtmlDialog::SetElementHtml |
Sets the innerHTML property of an HTML element. |
CDHtmlDialog::SetElementProperty |
Sets a property of an HTML element. |
CDHtmlDialog::SetElementText |
Sets the innerText property of an HTML element. |
CDHtmlDialog::SetExternalDispatch |
Sets the host's IDispatch interface. |
CDHtmlDialog::SetHostFlags |
Sets the host's UI flags. |
CDHtmlDialog::ShowContextMenu |
Called when a context menu is about to be displayed. |
CDHtmlDialog::ShowUI |
Shows the host's UI. |
CDHtmlDialog::TranslateAccelerator |
Called to process menu accelerator-key messages. |
CDHtmlDialog::TranslateUrl |
Called to modify the URL to be loaded. |
CDHtmlDialog::UpdateUI |
Called to notify the host that the command state has changed. |
Name | Description |
---|---|
CDHtmlDialog::m_bUseHtmlTitle |
Indicates whether to use the HTML document's title as the dialog caption. |
CDHtmlDialog::m_nHtmlResID |
Resource ID of HTML resource to be displayed. |
CDHtmlDialog::m_pBrowserApp |
A pointer to a Web browser application. |
CDHtmlDialog::m_spHtmlDoc |
A pointer to an HTML document. |
CDHtmlDialog::m_strCurrentUrl |
The current URL. |
CDHtmlDialog::m_szHtmlResID |
String 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.
CDHtmlSinkHandlerBase2
CDHtmlSinkHandlerBase1
CDHtmlSinkHandler
CDHtmlEventSink
CDHtmlDialog
Header: afxdhtml.h
The DDX_DHtml
helper macros allow easy access to the commonly used properties of controls on an HTML page.
Name | Description |
---|---|
DDX_DHtml_ElementValue |
Sets or retrieves the Value property from the selected control. |
DDX_DHtml_ElementInnerText |
Sets or retrieves the text between the start and end tags of the current element. |
DDX_DHtml_ElementInnerHtml |
Sets or retrieves the HTML between the start and end tags of the current element. |
DDX_DHtml_Anchor_Href |
Sets or retrieves the destination URL or anchor point. |
DDX_DHtml_Anchor_Target |
Sets or retrieves the target window or frame. |
DDX_DHtml_Img_Src |
Sets or retrieves the name of an image or a video clip in the document. |
DDX_DHtml_Frame_Src |
Sets or retrieves the URL of the associated frame. |
DDX_DHtml_IFrame_Src |
Sets 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 aren't safe for scripting.
virtual BOOL CanAccessExternal();
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);
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's 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.
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();
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 */);
pContainer
A pointer to the COleControlContainer
object.
ppSite
A pointer to a pointer to a COleControlSite
.
Nonzero if successful; otherwise 0.
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);
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.
[!code-cppNVC_MFCHtmlHttp#1]
Exchanges data between a member variable and a check box on an HTML page.
void DDX_DHtml_CheckBox(
CDataExchange* pDX,
LPCTSTR szId,
int& value);
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.
[!code-cppNVC_MFCHtmlHttp#2]
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);
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);
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);
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);
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);
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.
[!code-cppNVC_MFCHtmlHttp#3]
Detaches a modeless dialog box from the CDHtmlDialog
object and destroys the object.
void DestroyModeless();
Enables modeless dialog boxes.
STDMETHOD(EnableModeless)(BOOL fEnable);
fEnable
See fEnable
in IDocHostUIHandler::EnableModeless
in the Windows SDK.
Returns E_NOTIMPL
.
This member function is the CDHtmlDialog
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);
pDO
See pDO
in IDocHostUIHandler::FilterDataObject
in the Windows SDK.
ppDORet
See ppDORet
in IDocHostUIHandler::FilterDataObject
in the Windows SDK.
Returns S_FALSE
.
This member function is the CDHtmlDialog
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);
szId
The HTML ID of an ActiveX control.
ppdisp
The IDispatch
interface of the control if found in the Web page.
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);
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.
A variant containing the requested property or an empty variant if the control or property couldn't be found.
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);
szUrl
A CString
object containing the URL to retrieve.
Retrieves the IHTMLDocument2
interface on the currently loaded HTML document.
HRESULT GetDHtmlDocument(IHTMLDocument2 **pphtmlDoc);
**pphtmlDoc
A pointer to a pointer to an HTML document.
A standard HRESULT
. Returns S_OK
if successful.
Called by the contained WebBrowser control when it's being used as a drop target to allow the dialog to supply an alternative IDropTarget
.
STDMETHOD(GetDropTarget)(
IDropTarget* pDropTarget,
IDropTarget** ppDropTarget);
pDropTarget
See pDropTarget
in IDocHostUIHandler::GetDropTarget
in the Windows SDK.
ppDropTarget
See ppDropTarget
in IDocHostUIHandler::GetDropTarget
in the Windows SDK.
Returns E_NOTIMPL
.
This member function is the CDHtmlDialog
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);
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.
A standard HRESULT
value.
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's 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);
szElementId
The ID of an HTML element.
The innerHTML
property of the HTML element identified by szElementId
or NULL
if the element couldn't 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 refiid,
void** ppvObj);
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.
refiid
The interface ID (IID) of the requested interface.
A standard HRESULT
value.
[!code-cppNVC_MFCHtmlHttp#4]
Retrieves the value of the property identified by dispId
from the HTML element identified by szElementId
.
VARIANT GetElementProperty(
LPCTSTR szElementId,
DISPID dispId);
szElementId
The ID of an HTML element.
dispId
The dispatch ID of a property.
The value of the property or an empty variant if the property or element couldn't be found.
Retrieves the innerText
property of the HTML element identified by szElementId
.
BSTR GetElementText(LPCTSTR szElementId);
szElementId
The ID of an HTML element.
The innerText
property of the HTML element identified by szElementId
or NULL
if the property or element couldn't be found.
Returns the IHTMLEventObj
pointer to the current event object.
HRESULT GetEvent(IHTMLEventObj** ppEventObj);
ppEventObj
Address of a pointer that will be filled with the IHTMLEventObj
interface pointer.
A standard HRESULT
value.
This function should only be called from within a DHTML event handler.
Gets the host's IDispatch
interface.
STDMETHOD(GetExternal)(IDispatch** ppDispatch);
ppDispatch
See ppDispatch
in IDocHostUIHandler::GetExternal
in the Windows SDK.
Returns S_OK
on success or E_NOTIMPL
on failure.
This member function is the CDHtmlDialog
implementation of IDocHostUIHandler::GetExternal
, as described in the Windows SDK.
Retrieves the host's UI capabilities.
STDMETHOD(GetHostInfo)(DOCHOSTUIINFO* pInfo);
pInfo
See pInfo
in IDocHostUIHandler::GetHostInfo
in the Windows SDK.
Returns S_OK
.
This member function is the CDHtmlDialog
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);
pchKey
See pchKey
in IDocHostUIHandler::GetOptionKeyPath
in the Windows SDK.
dw
See dw
in IDocHostUIHandler::GetOptionKeyPath
in the Windows SDK.
Returns E_NOTIMPL
.
This member function is the CDHtmlDialog
implementation of IDocHostUIHandler::GetOptionKeyPath
, as described in the Windows SDK.
Hides the host's UI.
STDMETHOD(HideUI)(void);
Returns E_NOTIMPL
.
This member function is the CDHtmlDialog
implementation of IDocHostUIHandler::HideUI
, as described in the Windows SDK.
Indicates whether the host's IDispatch
interface is safe for scripting.
virtual BOOL IsExternalDispatchSafe();
Returns FALSE
.
Loads the specified resource into the WebBrowser control in the DHTML dialog.
BOOL LoadFromResource(LPCTSTR lpszResource);
BOOL LoadFromResource(UINT nRes);
lpszResource
A pointer to a string containing the name of the resource to load.
nRes
The ID of the resource to load.
TRUE
if successful; otherwise FALSE
.
Indicates whether to use the HTML document's title as the dialog caption.
BOOL m_bUseHtmlTitle;
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;
[!code-cppNVC_MFCHtmlHttp#5]
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;
[!code-cppNVC_MFCHtmlHttp#6]
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);
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 isn't 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 doesn't specify any post data, Navigate
issues an HTTP GET transaction. This parameter is ignored if the URL isn't 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 doesn't specify any post data, Navigate
issues an HTTP GET transaction. This parameter is ignored if URL isn't an HTTP URL.
Called by the framework to cause an event to fire before a navigation occurs.
virtual void OnBeforeNavigate(
LPDISPATCH pDisp,
LPCTSTR szUrl);
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);
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);
fActivate
See fActivate
in IDocHostUIHandler::OnDocWindowActivate
in the Windows SDK.
Returns E_NOTIMPL
.
This member function is the CDHtmlDialog
implementation 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);
fActivate
See fActivate
in IDocHostUIHandler::OnFrameWindowActivate
in the Windows SDK.
Returns E_NOTIMPL
.
This member function is the CDHtmlDialog
implementation of IDocHostUIHandler::OnFrameWindowActivate
, as described in the Windows SDK.
Called in response to the WM_INITDIALOG
message.
virtual BOOL OnInitDialog();
The default implementation returns TRUE
.
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'll 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 don't 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);
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);
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.
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);
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);
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);
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);
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);
pdispExternal
The new IDispatch
interface.
Sets the host UI flags.
void SetHostFlags(DWORD dwFlags);
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);
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.
Returns S_FALSE
.
This member function is the CDHtmlDialog
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);
dwID
See dwID
in IDocHostUIHandler::ShowUI
in the Windows SDK.
pActiveObject
See 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.
Returns S_FALSE
.
This member function is the CDHtmlDialog
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);
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.
Returns S_FALSE
.
This member function is the CDHtmlDialog
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);
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.
Returns S_FALSE
.
This member function is the CDHtmlDialog
implementation of IDocHostUIHandler::TranslateUrl
, as described in the Windows SDK.
Called to notify the host that the command state has changed.
STDMETHOD(UpdateUI)(void);
Returns E_NOTIMPL
.
This member function is the CDHtmlDialog
implementation of IDocHostUIHandler::UpdateUI
, as described in the Windows SDK.
MFC Sample DHtmlExplore
DDX_DHtml
Helper Macros
Hierarchy Chart