티스토리 뷰

To check if a Windows program is running or not in C#, you can use the Process class from the System.Diagnostics namespace. Here's an example:

using System.Diagnostics;

// ...

string processName = "notepad"; // replace with the name of the process you want to check
bool isRunning = Process.GetProcessesByName(processName).Length > 0;
Console.WriteLine($"The {processName} process is {(isRunning ? "running" : "not running")}");
 

This code checks if a process with the specified name (in this case, "notepad") is running, and prints a message indicating whether it is running or not. You can replace "notepad" with the name of the process you want to check.

'개발' 카테고리의 다른 글

GraphQL에 대해서  (0) 2023.03.07
React 간단예제  (0) 2023.03.06
AJAX 간단 설명 및 예제  (0) 2023.03.03
DotNetty 빌드하는 법  (0) 2023.02.28
How does Grandmaster synchronize and train clocks from GPS/GNSS ?  (0) 2023.02.27
공지사항
최근에 올라온 글
Total
Today
Yesterday
최근에 달린 댓글
글 보관함