Managing Windows Indexing Service with Visual Basic.NET Using COM - Getting “Indexing service” status information with COM and VB.NET
(Page 2 of 4 )
The downloadable solution contains a “WinForms” application, which interacts with “Indexing Service” using COM (interoperating with .NET). It is important to note that, you need to add a reference to “Indexing Service Administration Type Library 1.0” (from COM tab) to your project, when you are working with Indexing Service using COM. You should see a “dll” named “Interop.CIODMLib.dll” within your “bin” folder, which works like a “.NET wrapper,” which interoperates with “Indexing Service.”
Let us go through a small code fragment, which I used to check the status of an “Indexing Service.”
Dim obj As New CIODMLib.AdminIndexServerClass
Private Sub btnStatus_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnStatus.Click
MessageBox.Show("Machine? " & obj.MachineName)
MessageBox.Show("Running? " & obj.IsRunning)
MessageBox.Show("Paused? " & obj.IsPaused)
End Sub
The “AdminIndexServerClass” within the “CIODMLib” namespace is used to get the information about the status of Indexing Service. In the above coding, I used “messageboxes” to make it simple. You can use any “label” or “checkbox” or “radio buttons” for a better look and feel.
You can also observe that the above code is totally different from what I used with WMI (in my previous article). I don’t think that I need to explain much about the above code anymore. It is as simple as that.
Next: How to change the “start mode” of (or manage) indexing service >>
More .NET Articles
More By Jagadish Chaterjee