語言

Process.TryGetProcessById(Int32, Process) 方法

定義

嘗試取得 Process 具有指定程序 ID 的現有程序的實例。

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

參數

processId
Int32

尋找程序的 ID。

process
Process

當此方法回傳true時,包含代表現有過程的 ;Process否則,。 null

傳回

true如果找到該過程;否則,。 false

屬性

例外狀況

processId 小於或等於零。

適用於