I have written a program which will send a fax in WinForms C# .NET.
Here is a part of my code (utilizes FXSCOM.DLL):
string documentName = System.Environment.CurrentDirectory + "\\CashServicesForm.pdf";
FAXCOMLib.FaxServerClass fs = new FAXCOMLib.FaxServerClass();
fs.Connect("ELJA");
object obj = fs.CreateDocument(documentName);
FAXCOMLib.FaxDoc fd = (FAXCOMLib.FaxDoc)obj;
string faxNumber = "228-8774";
string recipient = "Medical Office";
fd.FaxNumber = faxNumber;
fd.RecipientName = recipient;
int i = 0;
try
{
i = fd.Send();
}
catch (Exception ex)
{
MessageBox.Show("There was a problem sending the fax." + "\r\n\r\n" +
"Error details: " + ex.Message);
}
fs.Disconnect();
Now, the goal is to run this on another machine and connect to the FaxServer on the machine with the fax-modem connected. The host fax server machine is running Windows XP Professional. The client is running Windows XP Home.
When I run on the program on the client, I get the following error:
The handle is invalid-Exception from HRESULT: 0x80070006 (E_HANDLE)
I have tried another way which is this piece of code (using FXSCOMEX.DLL)
string documentName = System.Environment.CurrentDirectory + "\\CashServicesForm.pdf";
FAXCOMEXLib.FaxServerClass fs = new FAXCOMEXLib.FaxServerClass();
fs.Connect("ELJA");
FAXCOMEXLib.FaxDocument fd = new FAXCOMEXLib.FaxDocument();
fd.Body = documentName;
string faxNumber = "228-8774";
fd.Priority = FAXCOMEXLib.FAX_PRIORITY_TYPE_ENUM.fptNORMAL;
string recipient = "Medical Office";
fd.Recipients.Add(faxNumber, recipient);
try
{
object JobID = fd.ConnectedSubmit(fs);
}
catch (Exception ex)
{
MessageBox.Show("There was a problem sending the fax." + "\r\n\r\n" +
"Error details: " + ex.Message);
}
fs.Disconnect();
Connection to fax server failed (System.Runtime.InteropServicees.COMException (0x800706BA))
Is there something wrong that I need to do to connect to the server to send the fax? Can this be set up so that it will work on WinXP Professional/Home and not a Windows Server (R2008, 2012,etc) environment?