C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » .NET Framework »

Using Windows Fax Service of Windows 2000 in C#


Posted Date: 05 Aug 2004    Resource Type: Articles    Category: .NET Framework
Author: Syed Irfan AhmedMember Level: Bronze    
Rating: 1 out of 5Points: 10



Introduction

It is very simple to send a fax using Windows 2000 Fax Service in C#. The application makes use of FaxCom.dll that ships with Windows 2000
Adding a reference to FaxCom.dll
Add the reference to the FaxCom.dll. This dll is usually located in C:\WINNT\system32 folder. Within the VS.NET IDE, adding a reference to this DLL generates the equivalent Interop.

Adding the fax support

Once the FaxCom.dll is added, have the following code

FaxServerClass fs = new FaxServerClass();
fs.Connect("mymachine"); //specifies the machinename
object obj = fs.CreateDocument("myfilename");
FaxDoc fd = (FaxDoc)obj;
fd.FaxNumber = "myfax#";
fd.RecipientName = "Tester";
int i = fd.Send();
MessageBox.Show(i.ToString());
fs.Disconnect();

In the above code, the Connect method needs the name of the machine whose Windows Fax Service is to be used. myfilename specifies the file that is to be faxed and myfax# indicates the fax number to which the fax is to be sent.

Send() method sends the actual fax. Prior to using this application, we must make sure to attach the modem, install its drivers and see if the modem is shown within the Device Manager of Windows 2000(MyComputer->properties->hardware->Device Manager)

One thing to keep in mind is we cannot use Windows 2000 Fax Service for fax pooling. We need to move onto XP or higher version of Windows.

Summary

Using FaxCom.dll makes it easy to send a fax for small offices/business using Windows 2000 Fax Service. It needs nothing except a modem.




Responses

Author: Dave Lenz    15 Aug 2004Member Level: Bronze   Points : 0
I tried your sample and got this error message "The data is invalid" if I logon as administrator, but got another error "Access is denied" if I logon as regular user.

Am I missing something?

Using:
Visual Studio 2003 Enterprise version
Window 2000 with SP4
.Net SDK 1.1

Is there any library or permission I will have to set on my environment?

I tried both C# and VB, both give me the same error!

Thanx

Dave


Author: ramesh indrakanti    19 Nov 2004Member Level: Bronze   Points : 0
your code help me a lot.thanks for your code.and need one more information how to send the same fax to multiple recipients.help me please


Author: Suresh Babu    21 Dec 2004Member Level: Bronze   Points : 0
When I tried the same code in ASP.NET, while connecting to fax server(same system) 'fs.Connect("")' the following error is coming.

"System.Runtime.InteropServices.COMException: Unspecified error"

Am I missing any thing?



Author: Bharath Reddy VasiReddy    22 Jun 2007Member Level: Bronze   Points : 0
hai ,
I am getting the same error. (Unspecified error, i.e System.Runtime.InteropServices.COMException) Pls if any one has the answer pls send it to me asap...

Thanks in advance..
Bharath Reddy VasiReddy
bharathreddy.vasireddy@exensys.com




Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Resizing Images Dynamically
Previous Resource: Maximizing Application Performance under .NET Framework
Return to Discussion Resource Index
Post New Resource
Category: .NET Framework


Post resources and earn money!
 
Related Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use