Språk

Process.TryGetProcessById(Int32, Process) Metod

Definition

Försöker hämta en Process instans för en befintlig process med det angivna process-ID:t.

public:
 static bool TryGetProcessById(int processId, [Runtime::InteropServices::Out] System::Diagnostics::Process ^ % process);
[System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static bool TryGetProcessById(int processId, out System.Diagnostics.Process? process);
[<System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member TryGetProcessById : int * Process -> bool
Public Shared Function TryGetProcessById (processId As Integer, ByRef process As Process) As Boolean

Parametrar

processId
Int32

Process-ID för den process som ska hittas.

process
Process

När den här metoden returnerar trueinnehåller innehåller en Process som representerar den befintliga processen, nullannars .

Returer

trueom processen hittades. annars . false

Attribut

Undantag

processId är mindre än eller lika med noll.

Gäller för