. " Haga clic en "Referencias" y seleccione "Agregar ". Seleccionar ". NET " y luego haga clic en " System.ServiceProcess . " Haga clic en " Aceptar". Pulse la tecla "Ctrl " y "A" y pulse "Eliminar" para eliminar el código existente.
3 Copia y pega el siguiente código en el módulo " Module1.vb " . Este código determinará el estado de la "Apple Mobile Device " Servicio :
Importaciones System.ServiceProcess
Module Module1
Sub Main ()
Prueba
ServiceCtrler Dim As New ServiceController ( " Apple Mobile Device " )
Si ServiceCtrler.Status.Equals ( ServiceControllerStatus.Running ) Y ServiceCtrler.CanStop Entonces
Console.WriteLine ( ServiceCtrler.ServiceName )
Console.WriteLine ( "Status = " + ServiceCtrler.Status.ToString ( ))
Console.WriteLine ( "¿Puede pausar y continuar = " + _
< p> ServiceCtrler.CanPauseAndContinue.ToString ( ))
Console.WriteLine ( " puede apagar = " + ServiceCtrler.CanShutdown.ToString ( ))
Console.WriteLine ( " Can Stop = " + ServiceCtrler.CanStop.ToString ( ))
End If
Console.ReadLine ()
Catch ex As Exception
Console.WriteLine ( ex.Message )
End Try End Sub
End Module
4
editar la siguiente línea de código y escriba el nombre del servicio que que desee utilizar :
ServiceCtrler Dim As New ServiceController ( "Apple Mobile Device ")
5
Press "F5 " para ejecutar el programa
.