Tech Off Thread

1 post

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

COM Interop Question regarding FAXCOMEXLib

Back to Forum: Tech Off
  • User profile image
    Richard1975

    Can anyone please give me some help regarding how do you handle events for 
    FaxServer through .NET ie C# . My problem is I would like my application to be notified of the events that have been fired. I can't get the events to fire.
    Once I have called connectSubmit I would like the event, 
    FaxServer_OnOutgoingJobChanged to be fired so I can view the status of the fax on wheather it has been sent or an error eg. Incorrect fax number, no dial tone on the receiver etc.

    Also, I can't this to work with either a console app or a winforms app.
    I have tried to use WaitHandle etc with no success. Below is the following
    code, This code does include the waitHandle object :-
    using System;
    using FAXCOMEXLib;   // COM32
    namespace MyFax
    {
       public class Fax
        {
           private FAXCOMEXLib.FaxServer _faxServer;
           private IFaxDocument _docToFax; 
            public FAXCOMEXLib.FaxServer FaxServer
             {
     get{return _faxServer;  }
     set{_faxServer = value;  }
             }
            public IFaxDocument Document
            {
     get{return _docToFax;  } 
     set{_docToFax = value;  }
           }
          public virtual void SendFax()
           {  
              object jobId;
              FaxServer = new FaxServerClass();
              Document = new FaxDocumentClass(); 
        
              FaxServer.Connect(string.Empty);  
             FaxServer.ListenToServerEvents  
    (FAX_SERVER_EVENTS_TYPE_ENUM.fsetOUT_QUEUE |
    FAX_SERVER_EVENTS_TYPE_ENUM.fsetACTIVITY);
           FaxServer.OnOutgoingJobChanged += new    
    IFaxServerNotify_OnOutgoingJobChangedEventHandler(FaxServer_OnOutgoingJobChanged);
        
         Document.Body = _fileToFax; // tiff file to fax
         Document.DocumentName = _nameOfDocument;
         Document.Priority  = FAX_PRIORITY_TYPE_ENUM.fptHIGH;
         Document.Recipients.Add(FaxNumber, Recipient);
         Document.AttachFaxToReceipt = true;
         Document.ReceiptType = FAX_RECEIPT_TYPE_ENUM.frtNONE;
    /************************************************* */
    // HOW TO HANDLE THIS EVENT. FAX Console/ dialer starts up
    // however once this app has started up it then returns back to and  
    // assigns a jobid and continues on. My question is how to stop this from      
    // continuing on until I get a event from OnOutgoingJobChanged.
    /* ****************************************************** */
         jobId = Document.ConnectedSubmit(FaxServer);
       
    }
       public void FaxServer_OnOutgoingJobChanged(FaxServer pFaxServer, string 
    bstrJobId, FaxJobStatus pJobStatus)
        {
           // code to to log etc that a Fax event has occurred.
         }
       public Fax()
        {
          FaxServer = new FaxServerClass();
          Document= new FaxDocumentClass();
       
        }
    }
     

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.