Developing WinForms application with VS 2005 to programmatically
fax a document.
You could use fax service API to send fax in your application. Here is the
starting point for the Fax APIs:
First, there are no real samples in MSDN showing how to using the Fax
interfaces from a Managed language. The Fax documentation existed before
C# or VB.Net existed. However, using Fax from C# or VB.Net is very similar
to doing it from VB. You need to add a reference to the FaxComEx object
within the Visual Studio IDE and then reference the FAXCOMEXLib namespace.
Next, there are several programmatic interfaces to the Fax Service. There
is a “C” style API and two different COM interfaces. I strongly recommend
that you use FaxComEx, which is the most recent and by far the most robust
version. However, this is only supported on Windows XP and later. If you
must have support for Windows 2000, then you should investigate the FaxCom
interfaces. Here are some links that discuss the different options.
The following link provide a VB code example of sending a fax.
I think it might help more to introduce the following link to you, which
discusses “COM Interop from VB.NET”.
I also found some VB.NET and C# code samples as follows.
Sample Code :
FaxServerClass fs = new FaxServerClass();
fs.Connect(“<your_computer_name>”); //specifies the machinename
object obj = fs.CreateDocument(“<your_filename>”);
FaxDoc fd = (FaxDoc)obj;
fd.FaxNumber = “<your_fax_number_to_send_to”;
fd.RecipientName = “<your_recipients_name”;
int i = fd.Send();
Windows fax service will install without a fax modem installed in the computer.
But the above code will Fail with a “Unknown Interop Error” if you have no modem installed. The only way I could get it to work is by installing a modem.