0

I have a xaml application that has two buttons: one button starts execution of my exe application:

private void RunExe(string exeName)
    {
        try
        {
            process = new Process
            {
                StartInfo =
                {
                    FileName = exeName,
                    Verb = "runas",
                    WorkingDirectory = workingDir,
                    UseShellExecute = false,
                    RedirectStandardOutput = true,
                    CreateNoWindow = true,

                },
                EnableRaisingEvents = true
            };

            process.Start();
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }

The other button is a 'Stop' button. When it's clicked i would like to stop exe execution until user confirms in pop up he wants to stop. If he confirms exe process should be stopped, otherwise it should continue. Is it possible to achive?

Biba
  • 631
  • 9
  • 28
  • What do you mean "stopped"? You can kill another process with [Process.Kill](https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.process.kill?view=netframework-4.7.2). If you have sufficient privileges you can suspend it usind diagnostic APIs, the way tools like Process Explorer do. Those aren't available through the Process class – Panagiotis Kanavos Nov 09 '18 at 08:55
  • I want to act like described in https://stackoverflow.com/questions/71257/suspend-process-in-c-sharp but the resume function doesn't work for me. The program stays in Resume mode even though debugging shows it goes through Resume function. – Biba Nov 13 '18 at 09:22

0 Answers0