The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Windows Dienste mit C# und .NET 2.0 kontrollieren

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
-

Posts: 1524
Nickname: nitronic
Registered: Jul, 2006

Norbert Eder works as a software architect.
Windows Dienste mit C# und .NET 2.0 kontrollieren Posted: Dec 14, 2006 8:47 AM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by -.
Original Post: Windows Dienste mit C# und .NET 2.0 kontrollieren
Feed Title: Norbert Eder - Living .NET
Feed URL: http://feeds.feedburner.com/NorbertEder-Livingnet
Feed Description: Copyright (c)2005, 2006 by Norbert Eder
Latest .NET Buzz Posts
Latest .NET Buzz Posts by -
Latest Posts From Norbert Eder - Living .NET

Advertisement
Hier eine kleine Demoklasse die den Umgang mit Windows-Diensten zeigt. Die Klasse selbst bietet nur die M��glichkeit den Status eines Dienstes abzufragen und diesen zu Starten bzw. zu Stoppen. Weitere M��glichkeiten kann den Klassen ServiceController entnommen werden.

public class ProcessHandler
{
private string processName = null;

public string ProcessName
{
get { return this.processName; }
set { this.processName = value; }
}

public ServiceControllerStatus GetProcessState()
{
ServiceController sc = new ServiceController(processName);
if (sc != null)
{
return sc.Status;
}
return ServiceControllerStatus.Stopped;
}

public void StartProcess()
{
ServiceController sc = new ServiceController(processName);
if (sc != null)
sc.Start();
}

public void StopProcess()
{
ServiceController sc = new ServiceController(processName);
if (sc != null && sc.CanStop)
sc.Stop();
}

}

Read: Windows Dienste mit C# und .NET 2.0 kontrollieren

Topic: AI : Neural Network for beginners (Part 3 of 3) Previous Topic   Next Topic Topic: Using the .NET 2.0 Ping class

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use