@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: The OpenService function opens an existing service. !!!!C# Signature: [DllImport("advapi32.dll", SetLastError=true, CharSet=CharSet.Auto)] static extern IntPtr OpenService(IntPtr hSCManager, string lpServiceName, uint dwDesiredAccess); !!!!VB Signature: <DllImport("advapi32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _ Private Shared Function OpenService(ByVal hSCManager As IntPtr, ByVal lpServiceName As String, ByVal dwDesiredAccess As Int32) As IntPtr End Function !!!!VB .NET Signature: Declare Function OpenService Lib "advapi32.dll" Alias "OpenServiceA" (ByVal hSCManager As IntPtr, ByVal lpServiceName As String, ByVal dwDesiredAccess As Integer) As IntPtr !!!!User-Defined Types: [SERVICE_ACCESS] !!!!Notes: None. !!!!Tips & Tricks: Please add some! !!!!Sample Code: The following sample opens the service with privileges to stop and delete it: IntPtr hService = OpenService(hSCM, ServiceName, ((uint)SERVICE_ACCESS.SERVICE_STOP | (uint)System.Messaging.StandardAccessRights.Delete)); !!!!Alternative Managed API: Unless you are going use EnumDependentServices API please use 'System''.''ServiceProcess''.''ServiceController' that is provided in the framework. Documentation: OpenService@msdn on MSDN
Edit advapi32.OpenService
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.