0

"public: virtual long __stdcall PCI1761Event::GetTypeInfoCount(unsigned int *)" (?GetTypeInfoCount@PCI1761Event@@UAGJPAI@Z)

代码

类 PCI1761Event:
公共 CComObjectRoot,
公共 _IAdvDIOEvents
{

公共:
BEGIN_COM_MAP(PCI1761Event)
COM_INTERFACE_ENTRY(_IAdvDIOEvents)END_COM_MAP
()

PCI1761Event(void);<br>

HRESULT  OnDiInterrupt (
    long channel,
    VARIANT * data,
    long scanStart,
    long scanCount );<br>

HRESULT OnDiStatusChange (
    long port,
    VARIANT * data,
    long scanStart,
    long scanCount );<br>

HRESULT OnDiPatternMatch (
    long port,
    VARIANT * data,
    long scanStart,
    long scanCount );<br>

HRESULT OnDeviceRemoved (
    long DeviceNumber );
  HRESULT STDMETHODCALLTYPE GetTypeInfoCount( 
        /* [out] */ UINT *pctinfo) ;<br>

     HRESULT STDMETHODCALLTYPE GetTypeInfo( 
        /* [in] */ UINT iTInfo,
        /* [in] */ LCID lcid,
        /* [out] */ ITypeInfo **ppTInfo) ;

    HRESULT STDMETHODCALLTYPE GetIDsOfNames( 
        /* [in] */ REFIID riid,
        /* [size_is][in] */ LPOLESTR *rgszNames,
        /* [in] */ UINT cNames,
        /* [in] */ LCID lcid,
        /* [size_is][out] */ DISPID *rgDispId) ;

    /* [local] */ HRESULT STDMETHODCALLTYPE Invoke( 
        /* [in] */ DISPID dispIdMember,
        /* [in] */ REFIID riid,
        /* [in] */ LCID lcid,
        /* [in] */ WORD wFlags,
        /* [out][in] */ DISPPARAMS *pDispParams,
        /* [out] */ VARIANT *pVarResult,
        /* [out] */ EXCEPINFO *pExcepInfo,
        /* [out] */ UINT *puArgErr) ;

公共:~PCI1761事件(无效);};

为什么????

4

1 回答 1

1

因为_IAdvDIOEvents您尝试实现的接口是派生自的IDispatch,因此您也必须在类上实现IDispatch方法。在 ATL 中,您通常从类继承您的类,IDispatchImpl<_IAdvDIOEvents, ...>以便为您实现方法。

于 2012-06-28T17:12:04.150 回答