Device.GetRemoteProcess メソッド

更新 : 2007 年 11 月

デバイス上でプロセスを開始および終了するために使用される RemoteProcess のインスタンスを作成して返します。

名前空間 :  Microsoft.SmartDevice.Connectivity
アセンブリ :  Microsoft.SmartDevice.Connectivity (Microsoft.SmartDevice.Connectivity.dll 内)

構文

'宣言
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

戻り値

型 : Microsoft.SmartDevice.Connectivity.RemoteProcess

RemoteProcess 型のオブジェクトを返します。

例外

例外 条件
DeviceNotConnectedException

デバイスが接続されていません。

SmartDeviceException

基になる COM コンポーネントによって COM 例外がスローされました。

解説

デバイスは接続されている必要があります。

' 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());
}

アクセス許可

  • 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

参照

Device クラス

Device メンバ

Microsoft.SmartDevice.Connectivity 名前空間