cocomserverimpl.h

来自「<<C++Builder 6实用编程100例>>随书光盘」· C头文件 代码 · 共 60 行

H
60
字号
// COCOMSERVERIMPL.H : Declaration of the TCoComServerImpl

#ifndef CoComServerImplH
#define CoComServerImplH

#define ATL_APARTMENT_THREADED

#include "ComServer_TLB.H"


/////////////////////////////////////////////////////////////////////////////
// TCoComServerImpl     Implements ICoComServer, default interface of CoComServer
// ThreadingModel : Apartment
// Dual Interface : FALSE
// Event Support  : FALSE
// Default ProgID : ComServer.CoComServer
// Description    : 
/////////////////////////////////////////////////////////////////////////////
class ATL_NO_VTABLE TCoComServerImpl : 
  public CComObjectRootEx<CComSingleThreadModel>,
  public CComCoClass<TCoComServerImpl, &CLSID_CoComServer>,
  public ICoComServer
{
public:
        long sum;
  TCoComServerImpl()
  {
        sum=0;
  }

  // Data used when registering Object 
  //
  DECLARE_THREADING_MODEL(otApartment);
  DECLARE_PROGID("ComServer.CoComServer");
  DECLARE_DESCRIPTION("");

  // Function invoked to (un)register object
  //
  static HRESULT WINAPI UpdateRegistry(BOOL bRegister)
  {
    TTypedComServerRegistrarT<TCoComServerImpl> 
    regObj(GetObjectCLSID(), GetProgID(), GetDescription());
    return regObj.UpdateRegistry(bRegister);
  }


BEGIN_COM_MAP(TCoComServerImpl)
  COM_INTERFACE_ENTRY(ICoComServer)
END_COM_MAP()

// ICoComServer
public:
 
  long STDMETHODCALLTYPE Add(long x, long y);
  STDMETHOD(get_Value(long* Value));
  STDMETHOD(set_Value(long Value));
};

#endif //CoComServerImplH

⌨️ 快捷键说明

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