compa.h

来自「学习COM组件编程的入门示例源代码。与《COM原理与应用》一书配套。」· C头文件 代码 · 共 42 行

H
42
字号
#ifndef __CompA_H__
#define __CompA_H__

#ifndef __ISomeInterface_H__
#include "SomeIFace.h"
#endif

class INondelegatingUnknown
{
public:
	virtual HRESULT  __stdcall  NondelegationQueryInterface(const IID& iid, void **ppv) = 0 ;
	virtual ULONG	 __stdcall  NondelegatingAddRef() = 0; 
	virtual ULONG	 __stdcall  NondelegationRelease() = 0;
};

class CA : public ISomeInterface, public INondelegatingUnknown
{
protected:
     ULONG           m_Ref;

public:
     CA(IUnknown *pUnknownOuter);
     ~CA();

public :
	// Delegating IUnknown
	virtual HRESULT	  __stdcall  QueryInterface(const IID& iid, void **ppv) ;
	virtual ULONG	  __stdcall  AddRef() ; 
	virtual ULONG	  __stdcall  Release() ;

	// Nondelegating IUnknown
	virtual HRESULT   __stdcall  NondelegationQueryInterface(const IID& iid, void **ppv);
	virtual ULONG	  __stdcall  NondelegatingAddRef();
	virtual ULONG	  __stdcall  NondelegationRelease();

	virtual HRESULT __stdcall SomeFunction( ) ;

	private :
		IUnknown  *m_pUnknownOuter;  // pointer to outer IUnknown
};

#endif __CompA_H__

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?