如何在COM中創建一個返回指向接口的指針的方法,這需要在IDL文件中完成。COM - 如何創建一個返回指向接口的指針的方法?
編輯:
如何在類中實現這一點:
STDMETHODIMP CBlah::get_Something(IOtherBlah** retval){
return m_protectedvar->QueryInterface(retval);
}
STDMETHODIMP CBlah::put_Somthing(IOtherBlah* rhs){
m_protectedvar = rhs;
return S_OK;
}
以上不工作。我收到以下錯誤:
cannot instantiate abstract class with[ Base=Blah ] due to following members:
'HRESULT IBlah::putref_Something(IOtherBlah*)' : is abstract
@Phill - 您爲什麼取消標記答案?你還需要什麼? – 2010-01-26 16:02:44
我收到錯誤,請參閱編輯 – 2010-01-26 16:33:18
您必須編寫putref_Something(),而不是put_Somthing()。 – 2010-01-26 16:39:51