We help IT Professionals succeed at work.

Getting fax status back using Faxcomex.lib

Medium Priority
3,154 Views
Last Modified: 2012-05-06
Hi,

I  can sucessfully send a fax to a fax server with the following code.However, I also need to get the status back. From what I have read for XP (or server 2003) you need monitor specific fax events and use delgates for the callbacks.
I am getting a compile error on the attempt to add event handler as follows:

FAXCOMEXLib.IFaxAccountNotify_OnOutgoingJobAddedEventHandler(OnOutgoingJobAdded);

Error No overload for 'OnOutgoingJobAdded' matches delegate 'FAXCOMEXLib.IFaxAccountNotify_OnOutgoingJobAddedEventHandler'      



using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
using System.Net;
using System.Runtime.InteropServices;
using System.Threading;
using FAXCOMEXLib;
 
namespace TestFax2
{
    class Program
    {
        public static void OnOutgoingJobAdded(FaxServer pFaxServer, string bstrJobId)
        {
            Console.WriteLine("Job Incoming Added");
        }
        public static void OnOutgoingJobChanged(FaxServer pFaxServer, string bstrJobId,
                                                                                        FaxJobStatus pJobStatus)
        {
            if (pJobStatus.Status == FAXCOMEXLib.FAX_JOB_STATUS_ENUM.fjsCOMPLETED)
            {
                try
                {
                    Console.WriteLine("Fax Job Completed");
                }
                catch (Exception Ex)
                {
                    Console.WriteLine(Ex.Message);
                }
            }
        }
 
        static void Main(string[] args)
        {
            FAXCOMEXLib.FAX_SERVER_EVENTS_TYPE_ENUM FaxSvrEnum;
 
            try
            {
 
                FAXCOMEXLib.FaxDocumentClass faxdoc = new FAXCOMEXLib.FaxDocumentClass();
 
                FAXCOMEXLib.FaxServerClass faxserver = new FAXCOMEXLib.FaxServerClass();
 
                object JobID = new object();
 
                faxserver.Connect("host_address");
 
                FaxSvrEnum = (FAXCOMEXLib.FAX_SERVER_EVENTS_TYPE_ENUM.fsetOUT_QUEUE | FAXCOMEXLib.FAX_SERVER_EVENTS_TYPE_ENUM.fsetFXSSVC_ENDED);
 
                faxserver.ListenToServerEvents(FaxSvrEnum);
                //This does not compile
                faxserver.OnOutgoingJobAdded += new
                     FAXCOMEXLib.IFaxAccountNotify_OnOutgoingJobAddedEventHandler(OnOutgoingJobAdded);
                //This does not compile
                faxserver.OnOutgoingJobChanged += new 
                             IFaxServerNotify_OnOutgoingJobChangedEventHandler(faxserver_OnOutgoingJobChanged);
 
 
                faxdoc.Recipients.Add("9051234567", "John Smith");
 
                faxdoc.Body = @"c:\GPC\MOSS\Faxes\test.txt";
                JobID = faxdoc.ConnectedSubmit(faxserver);
                Console.WriteLine("Fax submitted");
                Console.ReadLine();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception caught SendFaxMessage: " + ex.ToString());
                Console.ReadLine();
            }
        }
    }
}

Open in new window

Comment
Watch Question

Author

Commented:

The code in question should actually be:

                faxserver.OnOutgoingJobAdded +=
                    new IFaxServerNotify_OnOutgoingJobAddedEventHandler(faxserver_OnOutgoingJobAdded);
                faxserver.OnOutgoingJobChanged +=
                    new IFaxServerNotify_OnOutgoingJobChangedEventHandler(faxserver_OnOutgoingJobChanged);

But I am still getting the same compile error.
Commented:
The issue is realted to building the project on a Vista machine when the intended target machine is XP or Server 2003. The Faxcomex,lib API is different on Vista. Closing this item.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.