Compartir a través de


Device.GetRemoteProcess (Método)

Actualización: noviembre 2007

Crea y devuelve una instancia de RemoteProcess que se utiliza para iniciar o finalizar un proceso en el dispositivo.

Espacio de nombres:  Microsoft.SmartDevice.Connectivity
Ensamblado:  Microsoft.SmartDevice.Connectivity (en Microsoft.SmartDevice.Connectivity.dll)

Sintaxis

Public Function GetRemoteProcess As RemoteProcess

Dim instance As Device
Dim returnValue As RemoteProcess

returnValue = instance.GetRemoteProcess()
public RemoteProcess GetRemoteProcess()
public:
RemoteProcess^ GetRemoteProcess()
public function GetRemoteProcess() : RemoteProcess

Valor devuelto

Tipo: Microsoft.SmartDevice.Connectivity.RemoteProcess

Devuelve un objeto del tipo RemoteProcess.

Excepciones

Excepción Condición
DeviceNotConnectedException

El dispositivo no está conectado.

SmartDeviceException

Los componentes COM subyacentes inician una excepción COM.

Comentarios

El dispositivo debe estar conectado.

Ejemplos

' Start the Calculator
Dim rp As RemoteProcess = device.GetRemoteProcess()
rp.Start("\windows\calc.exe", "")

' List all running processes 
Console.WriteLine("Type the number of the process you want to end" & _
                  vbCr & vbLf)
Dim processes As Collection(Of RemoteProcess) = device.GetRunningProcesses()
Dim i As Integer
For i = 0 To processes.Count - 1
    Console.WriteLine(i & ")  " & processes(i).FileName & _
                      " [" & processes(i).ToString() & "]")
Next i

' Get user input and end the process
Dim index As Integer = Convert.ToInt32(Console.ReadLine())
Console.WriteLine("Attempting to stop " & processes(index).FileName)
processes(index).Kill()
If processes(index).HasExited() Then
    Console.WriteLine("Process is no longer running")
End If
// Start the Calculator.
RemoteProcess rp = device.GetRemoteProcess();
rp.Start("\\windows\\calc.exe", "");

// List all running processes.
Console.WriteLine("Type the number of the process you want to end\r\n");
Collection<RemoteProcess> processes = device.GetRunningProcesses();
for (int i = 0; i < processes.Count; i++)
{
    Console.WriteLine(i + ")  " + processes[i].FileName + 
        " [" + processes[i].ToString() + "]");
}

// Get user input and end the process.
int index = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Attempting to stop " + processes[index].FileName);
processes[index].Kill();
if (processes[index].HasExited())
{
    Console.WriteLine("Process exited with code: " +
        processes[index].GetExitCode());
}

Permisos

Vea también

Referencia

Device (Clase)

Device (Miembros)

Microsoft.SmartDevice.Connectivity (Espacio de nombres)