共用方式為


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
    介面 IID ID () 所要求的介面。

傳回值

標準 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 類別

階層架構圖

CDHtmlDialog::GetElement

CDHtmlDialog::GetControlDispatch