public void FaxDocument(String TheFile, string faxnumber) { FAXCOMLib.FaxServer server = new FaxServerClass(); FAXCOMLib.FaxDoc doc = null; int response = -11; try { server.Connect(Environment.MachineName); } catch(Exception e) { lbl.Text +="-Connect"+ e.Message; //System.Console.WriteLine("1"+e.Message); } try { doc = (FAXCOMLib.FaxDoc)server.CreateDocument(TheFile); } catch(Exception e) { lbl.Text += "-doc error" + e.Message; //System.Console.WriteLine("doc error"+e.Message); } try { doc.FaxNumber = faxnumber; doc.RecipientName = "Test"; doc.DisplayName = "work"; } catch(Exception e) { lbl.Text += "assignments" + e.Message; //System.Console.WriteLine("assignments" + e.Message); } try { response = doc.Send(); Process myProcess = new Process(); if (Process.GetProcessesByName("AcroRd32").Length > 0) { myProcess = Process.GetProcessesByName("AcroRd32")[0]; if (DateTime.Now.Ticks - myProcess.StartTime.Ticks > TimeSpan.FromSeconds(1).Ticks) myProcess.Kill(); } } catch(Exception e) { lbl.Text +="-"+ response + e.Message; //System.Console.WriteLine( response + e.Message); } try { server.Disconnect(); } catch(Exception e) { lbl.Text += "disconnect" + e.Message; //System.Console.WriteLine("2"+e.Message); } lbl.Text += "Successful"; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)