Search Tools Links Login

Enumerate Services to Collection

Posted: 2019-08-22
By: AndreaTincani
Viewed: 214

Filed Under:

VB6 Windows API, VB6 Code Cache

Title Uploaded Size
enumerate_services.zip 8/22/2019 4:35:54 PM 4,378

Here is a class and module that enumerates the services on a Windows computer. It gets each service and puts its info into a public collection which can be used anywhere in the program.

The attached ZIP file contains the full class module, as well as the standard module.

Usage

Option Explicit Private Sub Command1_Click()
   Dim x As clsService
   Dim strHostName as String
   'Usage

   'Call procedure, where strHostName is the name of the Machine, use "" for the
   'Local Machine
   strHostName=""
   GetServiceInfo strHostName, SERVICE_ACTIVE Or SERVICE_INACTIVE
   For Each x In colServices
      MsgBox x.ServiceName
   Next
End Sub

Special Instructions

This code originally appeared on AndreaVB.com, and has been republished here with the permission of Andrea Tincani.


Comments on this post

No comments have been added for this post.

You must be logged in to make a comment.