static void Main() { ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = "SumatraPDF.exe"; string args = string.Format("-print-to-default \"{0}\" -exit-when-done", "xx.pdf"); startInfo.Arguments = args; startInfo.CreateNoWindow = true; startInfo.ErrorDialog = false; startInfo.UseShellExecute = false; Process process = Process.Start(startInfo); Console.WriteLine("Start Print."); //process.Exited += process_Exited; Recheck: if (!process.HasExited) { Console.WriteLine("Wait 1 Sec."); process.WaitForExit(1000); goto Recheck; } else { Console.WriteLine("Print Finish."); Console.ReadLine(); } Console.ReadLine(); }
While (!process.HasExited) { Console.WriteLine("Wait 1 Sec."); process.WaitForExit(1000); } Console.WriteLine("Print Finish."); Console.ReadLine();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)