Ejemplo n.º 1
0
    public ProcessHandle(Process process, int customId = -1)
    {
        this.CustomId = customId;
        this.Process  = process ?? throw new NullReferenceException();

        process.Refresh();
        if (process.Id == 0)
        {
            throw new Exception("Process does not appear to be running");
        }

        ProcessHandleManager.RegisterHandle(this);
    }
Ejemplo n.º 2
0
 /// <summary>
 /// Optional. If the specified process exits, the handle will be disposed of automatically
 /// </summary>
 public void Dispose()
 {
     ProcessHandleManager.UnregisterHandle(this);
 }