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.
|
| Author: Dave Lenz 15 Aug 2004 | Member 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 2004 | Member 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 2004 | Member 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 2007 | Member 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
|