static VirtualDesktop() { try { ComObjects.Initialize(); ComObjects.RegisterListener(); } catch (Exception ex) { InitializationException = ex; } AppDomain.CurrentDomain.ProcessExit += (sender, args) => ComObjects.Terminate(); }
static VirtualDesktop() { if (!IsSupported) { return; } try { ComObjects.Initialize(); } catch (Exception ex) { InitializationException = ex; _isSupportedInternal = false; } AppDomain.CurrentDomain.ProcessExit += (sender, args) => ComObjects.Terminate(); }