-6

For example: if one program had an alert, another separate program pop up when that alarm goes off?

  • 1
    Yes, you can run another program. There's plenty of info online (including here) about how to call an executable. – Andrew May 30 '18 at 23:26

1 Answers1

0

Yes, you can launch another program using C# code. Here's how you do that:

static void LaunchProgram()
    {
        // Path to program
        const string ex2 = "C:\\Dir";

        // Use ProcessStartInfo class
        ProcessStartInfo startInfo = new ProcessStartInfo();
        startInfo.CreateNoWindow = false;
        startInfo.UseShellExecute = false;

        //File name of program to launch
        startInfo.FileName = "program.exe";
        startInfo.WindowStyle = ProcessWindowStyle.Hidden;

        try
        {
            // Start the process with the info we specified.
            // Call WaitForExit and then the using statement will close.
            using (Process exeProcess = Process.Start(startInfo))
            {
                exeProcess.WaitForExit();
            }
        }
        catch
        {
             // Log error.
        }
    }
Mikaal Anwar
  • 1,720
  • 10
  • 21