Fixed Issue 73.
authormoel.mich
Sat, 12 Jun 2010 12:15:00 +0000
changeset 1399611b4d9d898
parent 138 1301992d8ae5
child 140 04a5155c9c1a
Fixed Issue 73.
GUI/StartupManager.cs
OpenHardwareMonitor.csproj
     1.1 --- a/GUI/StartupManager.cs	Tue Jun 08 21:07:13 2010 +0000
     1.2 +++ b/GUI/StartupManager.cs	Sat Jun 12 12:15:00 2010 +0000
     1.3 @@ -38,6 +38,7 @@
     1.4  using System;
     1.5  using System.Collections.Generic;
     1.6  using System.IO;
     1.7 +using System.Runtime.InteropServices;
     1.8  using System.Security.Principal;
     1.9  using System.Windows.Forms;
    1.10  using Microsoft.Win32;
    1.11 @@ -73,6 +74,9 @@
    1.12  
    1.13          if (scheduler != null) {
    1.14            try {
    1.15 +            // check if the taskscheduler is running
    1.16 +            IRunningTaskCollection collection = scheduler.GetRunningTasks(0);            
    1.17 +
    1.18              ITaskFolder folder = scheduler.GetFolder("\\Open Hardware Monitor");
    1.19              IRegisteredTask task = folder.GetTask("Startup");
    1.20              startup = (task != null) && 
    1.21 @@ -90,6 +94,8 @@
    1.22              startup = false;
    1.23            } catch (UnauthorizedAccessException) {
    1.24              scheduler = null;
    1.25 +          } catch (COMException) {
    1.26 +            scheduler = null;
    1.27            }
    1.28          } 
    1.29        } else {
     2.1 --- a/OpenHardwareMonitor.csproj	Tue Jun 08 21:07:13 2010 +0000
     2.2 +++ b/OpenHardwareMonitor.csproj	Sat Jun 12 12:15:00 2010 +0000
     2.3 @@ -1,4 +1,4 @@
     2.4 -<?xml version="1.0" encoding="utf-8"?>
     2.5 +<?xml version="1.0" encoding="utf-8"?>
     2.6  <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
     2.7    <PropertyGroup>
     2.8      <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>