Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ウィンドウへのハンドルを既に持っていると仮定すると、PID を取得できますGetWindowThreadProcessId。すべてのプロセスを取得して PID と一致させずにプロセス名を取得する方法はありますか?
GetWindowThreadProcessId
を使用Process.GetProcessByIdして取得できますProcess。 Process実行中のプログラムに関する多くの情報があります。 実行可能ファイルの名前を指定しますProcess.ProcessName。Process.MainModule.FileName
Process.GetProcessById
Process
Process.ProcessName
Process.MainModule.FileName
string name; using (var p = Process.GetProcessById(id)) { name = p.ProcessName; }