Here is an easy way to get the status of a Windows service. ''' <summary> ''' Gets the status of a Windows service. ''' </summary> ''' <param name="serviceName">Name of the service.</param> ''' <returns>ServiceControllerStatus.</returns> ''' <exception cref="InvalidOperationException">Service not found.</exception> ''' <exception cref="System.InvalidOperationException">Service not found.</exception> 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 ''' <summary> ''' Loads the service. ''' </summary> ''' <param name="serviceName">Name of the service.</param> ''' <returns>ServiceController.</returns> 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 [...]
Want to add speech to any of your apps running in Windows? It's pretty easy using the SpeechSynthesizer in the .NET Framework. You can see this code in action in my Visual Studio backup or cleaner apps. I use text to speach to notifiy the user what the app is up to without having to [...]
Do you need to kill (stop) a process running on Windows?
Here is a good video demonstrating a few of the cool new debugging features in Visual Studio 2015. https://channel9.msdn.com/Events/Visual-Studio/Visual-Studio-2015-Final-Release-Event/Universal-Windows-Apps-Debugging-and-Profiling/player?format=html5
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 [...]
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 [...]
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 [...]