Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Checks if the process with the same FileName has exited.
Namespace: Microsoft.SmartDevice.Connectivity
Assembly: Microsoft.SmartDevice.Connectivity (in Microsoft.SmartDevice.Connectivity.dll)
Syntax
'Declaration
Public Function HasExited As Boolean
'Usage
Dim instance As RemoteProcess
Dim returnValue As Boolean
returnValue = instance.HasExited()
public bool HasExited()
public:
bool HasExited()
public function HasExited() : boolean
Return Value
Type: System.Boolean
Returns true if the process has exited; otherwise, false.
Exceptions
Exception | Condition |
---|---|
InvalidOperationException | With a message string "Remote Process has not started", is thrown when the remote process has not started or "Remote Process has not exited" when the remote process has not exited yet. |
SmartDeviceException | An error occurred in the underlying COM components. |
Examples
' 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());
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.