예제 #1
0
        internal static T CreateInstance <T>(string fullName) where T : IUnknown
        {
            var s = WindowsCreateString(fullName);

            EnsureRoInitialized();
            var pUnk = RoActivateInstance(s);

            using var unk = MicroComRuntime.CreateProxyFor <IUnknown>(pUnk, true);
            WindowsDeleteString(s);
            return(MicroComRuntime.QueryInterface <T>(unk));
        }
예제 #2
0
        internal static TFactory CreateActivationFactory <TFactory>(string fullName) where TFactory : IUnknown
        {
            var s = WindowsCreateString(fullName);

            EnsureRoInitialized();
            var guid = MicroComRuntime.GetGuidFor(typeof(TFactory));
            var pUnk = RoGetActivationFactory(s, ref guid);

            using var unk = MicroComRuntime.CreateProxyFor <IUnknown>(pUnk, true);
            WindowsDeleteString(s);
            return(MicroComRuntime.QueryInterface <TFactory>(unk));
        }