Hi,
Find the code below, you could also use ServiceController.GetServices but
you will be able to get all the properties of the services , like imagepath,
or description
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
using System;
using System.IO;
using System.Text;
using System.ServiceProcess;
using System.Web;
using System.Collections;
using Microsoft.Win32;
ArrayList ar = new ArrayList();
//StreamWriter writer = new StreamWriter( "c:\\testwww.txt", false);
string[] st = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(
"System\\CurrentControlSet\\Services").GetSubKeyNa mes();
StringBuilder sb = new StringBuilder();
foreach( string key in st )
{
object imagePath;
object DisplayName;
if ( (imagePath =Microsoft.Win32.Registry.LocalMachine.OpenSubKey(
"System\\CurrentControlSet\\Services\\" + key).GetValue( "ImagePath"))
== null )
continue;
if ( (DisplayName =Microsoft.Win32.Registry.LocalMachine.OpenSubKey(
"System\\CurrentControlSet\\Services\\" + key).GetValue( "DisplayName"))
== null )
DisplayName = "Unknow";
sb.Append( "Service name=");
sb.Append( key );
sb.Append( " | ");
sb.Append( "DisplayName=");
sb.Append( DisplayName.ToString() );
sb.Append( " | ");
sb.Append( "Service image=");
sb.Append( imagePath.ToString() );
sb.Append( Environment.NewLine );
}
Cheers,
"r" <ra****@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
Hi,
I would like to create a dialog that shows all services in the
computer, much like services option in the control panel.
How can I traverse all services on the computer?
Thanks in advance