473,407 Members | 2,598 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,407 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 24860
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.