STDMETHODIMP CmyInterface::Square(long *pVal) { long value = *pVal; *pVal = value * value; return S_OK; }
STDMETHODIMP CmyInterface::Cube(long *pVal) { long value = *pVal; *pVal = value * value * value; return S_OK; } 注重这里使用了__uuidof(ImyInterface)来获取接口的IID,这是因为我们已经在第一步中将这个接口关联到了某个uuid。
class CClassFactory : public CComBase<>, public InterfaceImpl<IClassFactory>, public creatorClass { public: CClassFactory() {}; virtual ~CClassFactory() {};