Esempio n. 1
0
        public IntPtr CreateInstance(CLSCTX dwContext, string server)
        {
            IntPtr pInterface = IntPtr.Zero;

            if (dwContext == CLSCTX.ALL)
            {
                if (DefaultServerType == COMServerType.InProcServer32)
                {
                    dwContext = CLSCTX.INPROC_SERVER;
                }
                else if (DefaultServerType == COMServerType.LocalServer32)
                {
                    dwContext = CLSCTX.LOCAL_SERVER;
                }
                else if (DefaultServerType == COMServerType.InProcHandler32)
                {
                    dwContext = CLSCTX.INPROC_HANDLER;
                }
                else
                {
                    dwContext = CLSCTX.SERVER;
                }
            }

            Guid iid = COMInterfaceEntry.CreateKnownInterface(m_registry, COMInterfaceEntry.KnownInterfaces.IUnknown).Iid;

            return(COMUtilities.CreateInstance(Clsid, iid, dwContext, server));
        }