Retrieve The Status of a Windows Service

Here is an easy way to get the status of a Windows service. Public Function ServiceStatus(serviceName As String) As  ServiceControllerStatus Dim service As ServiceController = LoadService(serviceName) If service IsNot Nothing Then Return service.Status Else Throw New InvalidOperationException("Service not  found.") End If End Function Private Function LoadService(serviceName As String) As ServiceController      Return ServiceController.GetServices().Where(Function(p) p.ServiceName = serviceName).FirstOrDefault() End Function Here are the values for service status: ContinuePending Paused PausePending Running StartPending Stopped StopPending This and lost  more code can be found in the … Continue reading Retrieve The Status of a Windows Service

Retrieving Common Windows Paths

Someone asked me recently how to find the path to where Windows is installed. Well it's pretty easy using the code below: var path = Environment.GetFolderPath(Environment.SpecialFolder.Windows); Turns out there is a wealth of path information using the Environment.Special folder enumuration. Here is the output from my XP development machine: Desktop - C:\Documents and Settings\dotNetDave\Desktop Programs … Continue reading Retrieving Common Windows Paths

Windows API Code Pack for Microsoft .NET Framework

The Windows® API Code Pack for Microsoft® .NET Framework provides a source code library that can be used to access some new Windows 7 features (and some existing features of older versions of Windows operating system) from managed code. These Windows features are not available to developers today in the .NET Framework. Click here to … Continue reading Windows API Code Pack for Microsoft .NET Framework

Windows 7 Available for Download on August 6th

Developers with MSDN Subscriptions will be able to download Windows 7 RTM in English on August 6th and remaining languages by October 1st. To help developers who are developing applications for Windows 7 or updating existing applications to take advantage of new Windows 7 features, check out the Windows 7 for Developers Blog. Also, be … Continue reading Windows 7 Available for Download on August 6th