CDHtmlDialog::GetElementInterface

从 szElementId确定的HTML元素检索请求的接口指针。

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

参数

  • szElementId
    HTML元素的ID。

  • ppvObj
    将用请求的接口指针的指针地址,如果找到元素,则查询成功。

  • riid
    接口ID (IID)请求的接口。

返回值

标准 HRESULT 值。

示例

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

要求

Header: afxdhtml.h

请参见

参考

CDHtmlDialog Class

层次结构图

CDHtmlDialog::GetElement

CDHtmlDialog::GetControlDispatch