Files
Work/proto/source/CFACTORY.HPP
2024-08-07 09:16:27 -04:00

49 lines
1.3 KiB
C++

#ifndef _PROTO_CCLASSFACTORY_HPP_
#define _PROTO_CCLASSFACTORY_HPP_
#ifndef _COM_OLE2_HPP_
#include <com/ole2.hpp>
#endif
#ifndef _COMMON_SMARTPOINTER_HPP_
#include <common/pointer.hpp>
#endif
#ifndef _PROTO_DLLSERVER_HPP_
#include <proto/dllserve.hpp>
#endif
class CFSimpleObject;
class CImpIClassFactory : public IClassFactory
{
public:
CImpIClassFactory(SmartPointer<CFSimpleObject> &pBackObj,PIUnknown &pUnkOuter,SmartPointer<DLLServer> &server);
~CImpIClassFactory();
HRESULT __stdcall QueryInterface(REFIID riid,PPVOID ppv);
ULONG __stdcall AddRef(void);
ULONG __stdcall Release(void);
HRESULT __stdcall CreateInstance(IUnknown *pUnkOuter,REFIID riid,PPVOID ppv);
HRESULT __stdcall LockServer(BOOL lock);
private:
ULONG mRefCount;
SmartPointer<CFSimpleObject> mBackObj;
SmartPointer<DLLServer> mDLLServer;
PIUnknown mUnkOuter;
};
class CFSimpleObject : public IUnknown
{
public:
friend CImpIClassFactory;
CFSimpleObject(PIUnknown &pUnkOuter,SmartPointer<DLLServer> &server);
~CFSimpleObject();
HRESULT __stdcall QueryInterface(REFIID riid,PPVOID ppv);
ULONG __stdcall AddRef(void);
ULONG __stdcall Release(void);
private:
CImpIClassFactory mImpIClassFactory;
SmartPointer<DLLServer> mDLLServer;
PIUnknown mUnkOuter;
ULONG mRefCount;
};
typedef CFSimpleObject *PCFSimpleObject;
#endif