How to get the current ProcessID?

后端 未结 3 1447
囚心锁ツ
囚心锁ツ 2020-12-02 22:10

What\'s the simplest way to obtain the current process ID from within your own application, using the .NET Framework?

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-02 22:37

    Get a reference to the current process and use System.Diagnostics's Process.Id property:

    int nProcessID = Process.GetCurrentProcess().Id;
    

提交回复
热议问题