From 22ead804051382bac10a0706fa094acf32d798a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=B6ller?= Date: Sat, 12 Jun 2010 12:15:00 +0000 Subject: [PATCH] Fixed Issue 73. --- GUI/StartupManager.cs | 6 ++++++ OpenHardwareMonitor.csproj | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/GUI/StartupManager.cs b/GUI/StartupManager.cs index 1c58cd9..03b8107 100644 --- a/GUI/StartupManager.cs +++ b/GUI/StartupManager.cs @@ -38,6 +38,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Runtime.InteropServices; using System.Security.Principal; using System.Windows.Forms; using Microsoft.Win32; @@ -73,6 +74,9 @@ namespace OpenHardwareMonitor.GUI { if (scheduler != null) { try { + // check if the taskscheduler is running + IRunningTaskCollection collection = scheduler.GetRunningTasks(0); + ITaskFolder folder = scheduler.GetFolder("\\Open Hardware Monitor"); IRegisteredTask task = folder.GetTask("Startup"); startup = (task != null) && @@ -90,6 +94,8 @@ namespace OpenHardwareMonitor.GUI { startup = false; } catch (UnauthorizedAccessException) { scheduler = null; + } catch (COMException) { + scheduler = null; } } } else { diff --git a/OpenHardwareMonitor.csproj b/OpenHardwareMonitor.csproj index cc5a157..996940e 100644 --- a/OpenHardwareMonitor.csproj +++ b/OpenHardwareMonitor.csproj @@ -1,4 +1,4 @@ - + Debug