C#使用ServiceController控制windows服务
生活随笔
收集整理的這篇文章主要介紹了
C#使用ServiceController控制windows服务
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
C#中,使用ServiceController類控制windows服務,使用之前要先添加引用:System.ServiceProcess,然后在命名空間中引用:using System.ServiceProcess。下面舉例獲取本機的所有已安裝的Windows服務和應用,然后查找某一應用活服務是否已經安裝。
代碼:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.ServiceProcess;namespace 判斷機器中是否安裝了某項服務或者應用 {public partial class Form1 :總結
以上是生活随笔為你收集整理的C#使用ServiceController控制windows服务的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C#帮助控件HelpProvider的使
- 下一篇: C#创建PDF文档