Exemple #1
0
 /// <summary>
 /// Закрывает окно с FFMPEG
 /// </summary>
 public void Close()
 {
     //Process.StandardInput.AutoFlush = true;
     //Process.StandardInput.WriteLine("\x3");
     //Process.StandardInput.Close();
     //Process.MainWindowHandle.GetProcessId().GenerateConsoleCtrlEvent(CommonFunctions.ConsoleCtrlEvent.CTRL_C);
     if (Consoles.AttachConsole((uint)Process.Id))
     {
         Consoles.SetConsoleCtrlHandler(null, true);
         try
         {
             if (!Consoles.GenerateConsoleCtrlEvent(Consoles.CTRL_C_EVENT, 0))
             {
                 return;
             }
             Process.WaitForExit();
         }
         finally
         {
             Consoles.FreeConsole();
             Consoles.SetConsoleCtrlHandler(null, false);
         }
         return;
     }
 }