0

I have a form (progress bar) in C# which starts on double click of .exe. I want to close the form once the java application starts.

How do I achieve it?

static class Program
{
    static Form1 myForm;
    static void Main(string[] args)
    {         
            ProcessStartInfo startInfo = new ProcessStartInfo();
            // Prevents the cmd window for the batch file from showing up
            startInfo.CreateNoWindow = true;
            startInfo.UseShellExecute = false;
            // Absolute path to prevent running smartstart.bat from some other path
            startInfo.FileName = System.AppDomain.CurrentDomain.BaseDirectory + @"/myBat.bat";
            startInfo.WindowStyle = ProcessWindowStyle.Hidden;
            startInfo.Verb = "runas";
            Process process = Process.Start(startInfo);
            myForm = new Form1();
            System.Windows.Forms.Application.Run(myForm);
    }

}

How to check if the java application started?

Jannik
  • 2,310
  • 6
  • 32
  • 61
user2629457
  • 13
  • 2
  • 7

0 Answers0