public void GetImmersiveShell_ReturnsValidComObject() { var factory = new ComObjectFactory(); var result = factory.GetImmersiveShell(); Assert.NotNull(result); }
public void GetVirtualDesktopManagerInternal_ReturnsValidComObject() { var factory = new ComObjectFactory(); var result = factory.GetVirtualDesktopManagerInternal(); Assert.NotNull(result); }
public void GetIApplicationViewCollection_ReturnsValidComObject() { var factory = new ComObjectFactory(); var result = factory.GetIApplicationViewCollection(); Assert.NotNull(result); }
private static void SetDefaults() { try { IMultimediaDevice device; string devId; IntPtr devptr; var policyConfig = ComObjectFactory.GetPolicyConfig(); var deviceEnumerator = ComObjectFactory.GetDeviceEnumerator(); deviceEnumerator.GetDefaultAudioEndpoint(DataFlow.Render, Role.Communications, out devptr); device = Marshal.GetObjectForIUnknown(devptr) as IMultimediaDevice; if (device != null) { device.GetId(out devId); policyConfig.SetDefaultEndpoint(devId, Role.Communications); } deviceEnumerator.GetDefaultAudioEndpoint(DataFlow.Render, Role.Console, out devptr); device = Marshal.GetObjectForIUnknown(devptr) as IMultimediaDevice; if (device != null) { device.GetId(out devId); policyConfig.SetDefaultEndpoint(devId, Role.Console); } } catch (Exception) { // not worth failing for } }
internal static unsafe void RegisterInProcCOMServer() { var clsid = new Guid(ComObjectFactory.CLSID); const int CLSCTX_INPROC_SERVER = 1; const int REGCLS_MULTIPLEUSE = 1; void * classFactory = ComObjectFactory.Create(); int res = CoRegisterClassObject(in clsid, classFactory, CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, out int cookie); Xunit.Assert.Equal(ComConstants.S_OK, res); Marshal.Release((IntPtr)classFactory);