Inheritance: ComAPI.IClassFactory
Ejemplo n.º 1
0
        public SingletonClassFactoryRegistration(object instance, CLSID clsId)
        {
            _clsId = clsId;
            SingletonClassFactory factory = new SingletonClassFactory(instance);

            ComServer.RegisterClassFactory(_clsId, factory);
        }
Ejemplo n.º 2
0
        public SingletonClassFactoryRegistration(object instance, CLSID clsId)
        {
            _instance = instance;
            SingletonClassFactory factory = new SingletonClassFactory(instance);
            IntPtr pFactory = Marshal.GetIUnknownForObject(factory);
            // In versions < 0.29 we registered as REGCLS_SINGLEUSE even though it is not supposed to work for inproc servers.
            // It seems to do no harm to keep the ClassObject around.
            HRESULT result = ComAPI.CoRegisterClassObject(ref clsId, pFactory,
                                                          CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, out _classRegister);

            if (result != ComAPI.S_OK)
            {
                throw new InvalidOperationException("CoRegisterClassObject failed.");
            }
        }
Ejemplo n.º 3
0
 public SingletonClassFactoryRegistration(object instance, CLSID clsId)
 {
     _clsId = clsId;
     SingletonClassFactory factory = new SingletonClassFactory(instance);
     ComServer.RegisterClassFactory(_clsId, factory);
 }
        public SingletonClassFactoryRegistration(object instance, CLSID clsId)
        {
            _instance = instance;
            SingletonClassFactory factory = new SingletonClassFactory(instance);
            IntPtr pFactory = Marshal.GetIUnknownForObject(factory);
            // In versions < 0.29 we registered as REGCLS_SINGLEUSE even though it is not supposed to work for inproc servers.
            // It seems to do no harm to keep the ClassObject around.
            HRESULT result = ComAPI.CoRegisterClassObject(ref clsId, pFactory,
                                CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, out _classRegister);

            if (result != ComAPI.S_OK)
            {
                throw new InvalidOperationException("CoRegisterClassObject failed.");
            }
        }