RE: Check if Service Exists?
- From: Lucas Tam <REMOVEnntp@xxxxxxxxxx>
- Date: Tue, 21 Jun 2005 21:09:20 GMT
"=?Utf-8?B?RGFycmVsbCBXZXNsZXk=?="
<DarrellWesley@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
news:5FF845E6-2CF6-474B-938B-B0288CB20A7F@xxxxxxxxxxxxx:
> DOn't know if this the correct way or not but it's what one of our
> programs is doing to see if a Service is installed.
>
> '
> ' Check to see if VNC is installed
> '
> Dim scServices() = ServiceController.GetServices()
> Dim i As Integer = 0
>
> While i < scServices.Length
> 'MessageBox.Show(scServices(i).DisplayName)
> If scServices(i).DisplayName = "VNC Server" Then
> m_bVNC = True
> End If
> i = i + 1
> End While
Thank you - I was hoping to avoid looping through all my services. I was
sort of expecting that .NET would throw an error if it tried to create
an non-existing service.
i.e. New ServiceController("NoSuchService")
But it doesn't.
In anycase, the GetServices method way will work just fine for me.
Thank you : )
--
Lucas Tam (REMOVEnntp@xxxxxxxxxx)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
.
- References:
- Check if Service Exists?
- From: Lucas Tam
- RE: Check if Service Exists?
- From: Darrell Wesley
- Check if Service Exists?
- Prev by Date: windows app autoexit
- Next by Date: string conversion
- Previous by thread: RE: Check if Service Exists?
- Next by thread: primary key problem
- Index(es):
Relevant Pages
|