共用方式為


CDHtmlDialog::GetElementInterface

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

Requirements

Header: afxdhtml.h

See Also

Reference

CDHtmlDialog Class

Hierarchy Chart

CDHtmlDialog::GetElement

CDHtmlDialog::GetControlDispatch