473,401 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

example usage of FAXCOMEXLib in csharp dotnet

G'Day,

I am searching for an example of using FAXCOMEXLib in csharp.

The COM interfaces are documented on msdn.microsoft.com however the
examples are for VB and c++.

Following up on a previous topic, FAXCOMEXLib is not in
FAXCOMEXLib.dll, but rather Interop.FAXCOMEXLib.dll

I added a reference to c:\windows\system32\fxscomex.dll to the project,
and it must translate to the above Interop.FAXCOMEXLib.dll

I am a little confused about adding a recipient to a fax document.

I have the fax document object, but the recipients member is
read-only?? So there must be another avenue for adding recipients that
I am yet to discover.

Here is my paltry code (based on code in another newsgroup for
FAXCOMLib)
<code>
using System;
using System.IO;
using System.ComponentModel;
using System.Collections;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Threading;
using System.Windows.Forms;
using FAXCOMEXLib;

namespace csFaxComponent
{
public class csFax
{
protected FaxServer ofs = null;
public static void Main()
{
int JobID = 0;
csFax objcsFax = new csFax();
JobID = objcsFax.FaxDocument("C:\\Temp\\any file.txt", "911");
}

private int FaxDocument(String TheFile, string faxnumber)
{
int JobID=0;
FAXCOMEXLib.FaxServer faxsrv = new FAXCOMEXLib.FaxServerClass();
try
{
faxsrv.Connect("");
//Pick up the new changed document and fax it out.
FAXCOMEXLib.FaxDocument faxdoc = new
FAXCOMEXLib.FaxDocumentClass();
faxdoc.Body = TheFile;
//Name the document
faxdoc.DocumentName = "Fax Transmission";
faxdoc.ReceiptAddress = "bo*@doe.com";
FAXCOMEXLib.FaxRecipients frs = new
FAXCOMEXLib.FaxRecipientsClass();
frs.Add(faxnumber, "John Doe");
faxdoc.Recipients = frs;
faxdoc.ConnectedSubmit(faxsrv);
}
catch
{
}
finally
{
faxsrv.Disconnect();
Marshal.ReleaseComObject(frs);
Marshal.ReleaseComObject(faxdoc);
Marshal.ReleaseComObject(faxsrv);
}
return JobID;
}
}
}
</code>

I was able to send a fax using FAXCOM but I could not seem to get a
good status reply.

I will be faxing out several hundred documents generated by a mail
merge and if there is a problem faxing, then we want to fall back to a
printed/posted document. So the status/jobid is important.

Thanks,

Kim Groves
Accidental

Nov 17 '05 #1
1 24859
There is no need to release the COM wrapper object explicitly - garbage
collector copes with it just fine.

Adding recipients:
strig Phone = "333 555-7676";
FaxRecipient rcpt = faxDoc.Recipients.Add(phone, "Bob Recipient");

Finally, you'll find it very helpful to catch an exception and print it
instead of swallowing. For the period of initial debugging you might even
want to do away with try/catch and let the Studio to break on exception.
This way you know exactly where it happened

--
Alex Feinman
---
Visit http://www.opennetcf.org
"kagorami" <di******@netspace.net.au> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
G'Day,

I am searching for an example of using FAXCOMEXLib in csharp.

The COM interfaces are documented on msdn.microsoft.com however the
examples are for VB and c++.

Following up on a previous topic, FAXCOMEXLib is not in
FAXCOMEXLib.dll, but rather Interop.FAXCOMEXLib.dll

I added a reference to c:\windows\system32\fxscomex.dll to the project,
and it must translate to the above Interop.FAXCOMEXLib.dll

I am a little confused about adding a recipient to a fax document.

I have the fax document object, but the recipients member is
read-only?? So there must be another avenue for adding recipients that
I am yet to discover.

Here is my paltry code (based on code in another newsgroup for
FAXCOMLib)
<code>
using System;
using System.IO;
using System.ComponentModel;
using System.Collections;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Threading;
using System.Windows.Forms;
using FAXCOMEXLib;

namespace csFaxComponent
{
public class csFax
{
protected FaxServer ofs = null;
public static void Main()
{
int JobID = 0;
csFax objcsFax = new csFax();
JobID = objcsFax.FaxDocument("C:\\Temp\\any file.txt", "911");
}

private int FaxDocument(String TheFile, string faxnumber)
{
int JobID=0;
FAXCOMEXLib.FaxServer faxsrv = new FAXCOMEXLib.FaxServerClass();
try
{
faxsrv.Connect("");
//Pick up the new changed document and fax it out.
FAXCOMEXLib.FaxDocument faxdoc = new
FAXCOMEXLib.FaxDocumentClass();
faxdoc.Body = TheFile;
//Name the document
faxdoc.DocumentName = "Fax Transmission";
faxdoc.ReceiptAddress = "bo*@doe.com";
FAXCOMEXLib.FaxRecipients frs = new
FAXCOMEXLib.FaxRecipientsClass();
frs.Add(faxnumber, "John Doe");
faxdoc.Recipients = frs;
faxdoc.ConnectedSubmit(faxsrv);
}
catch
{
}
finally
{
faxsrv.Disconnect();
Marshal.ReleaseComObject(frs);
Marshal.ReleaseComObject(faxdoc);
Marshal.ReleaseComObject(faxsrv);
}
return JobID;
}
}
}
</code>

I was able to send a fax using FAXCOM but I could not seem to get a
good status reply.

I will be faxing out several hundred documents generated by a mail
merge and if there is a problem faxing, then we want to fall back to a
printed/posted document. So the status/jobid is important.

Thanks,

Kim Groves
Accidental


Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Brett | last post by:
I am currently in the process of building a vb.net windows application that will be used to send faxes and monitor these faxes as they are sent. In the project I am building the fax functionality...
26
by: Bruno Jouhier [MVP] | last post by:
I'm currently experiencing a strange phenomenon: At my Office, Visual Studio takes a very long time to compile our solution (more than 1 minute for the first project). At home, Visual Studio...
2
by: Wilson | last post by:
Hi, I try to use FAXCOMEXLib in the program. I got errors when using Statement : FaxRecipients cFaxReceipients = new FAXCOMEXLib.FaxRecipientsClass() ; Error :...
1
by: AdamD | last post by:
Does anyone have an example of how to use this object Basically, I want to check for changes in a directory automatically and if their are changes to it (ie FTP) then I want the system to auto...
4
by: BrianDH | last post by:
hi Looking for Vb.Net examples of reciving email via windows form Thanks
1
by: jacegar | last post by:
Hello, I try to send a html file using FAXCOMEXLib. The process go succesfull, but show the printer sellection windows. How can i do to not show this window? The source code is this: ...
2
by: Rick | last post by:
VS.NET 2005 I am developing a fax routine in a NET program using the FAXCOMExLib.dll Everything works as planned when I run from my development machine. When I put the program on the server...
0
by: Kent Bolton | last post by:
We have had the same issue ... it seems that the COM Interop wrapper leaks quite a lot of memory when iterating through the faxes in the folders. We found that we could avoid this by iterating...
8
by: sonnykei | last post by:
Hi All, In my application, I am currently employing FAXCOMEXLib to send out faxes. It works great, but one issue still remains. How can I send out multiple attachments in one Fax transmission...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.