Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionstatic String cheminAcroRd32 = @"C:\Program Files\Adobe\Reader 10.0\Reader\AcroRd32.exe"; static Int32 waitingTime = 10000; static void Main(string[] args) { if (args.Length != 1) { Console.WriteLine("ERREUR - Usage: print [fichierPDF]"); } else { try { string filePath = args[0]; Process proc = new Process(); proc.StartInfo.FileName = cheminAcroRd32; proc.StartInfo.Arguments = "/p " + filePath; proc.Start(); if (proc.HasExited == false) { proc.WaitForExit(waitingTime); proc.Kill(); } proc.EnableRaisingEvents = true; proc.CloseMainWindow(); proc.Close(); } catch (Exception e) { Console.WriteLine(e.Message); } } }
proc.StartInfo.FileName = cheminAcroRd32;
proc.StartInfo.FileName = getDefaultApplication(filepath);
private static string findExecutable( string filepath ) { StringBuilder objResultBuffer = new StringBuilder(1024); long lngResult = 0; lngResult = FindExecutableA( filepath, string.Empty, objResultBuffer ); if (lngResult >= 32) { return objResultBuffer.ToString(); } return string.Format( "Error: ({0})", lngResult ); } [DllImport( "shell32.dll", EntryPoint = "FindExecutable" )] private static extern long FindExecutableA( string lpFile, string lpDirectory, StringBuilder lpResult );