Monitoring outgoing fax messages with a windows service

Joined
Sep 12, 2005
Messages
8
Reaction score
0
Hi,

I'm creating a Windows Service that is supposed to listen to the Outgoing_Archive and handle the event when a message has been successfully sent. I do this programmatically with a C# application using the FAXCOMEXLib dll. My problem is that the application doesn't write to the eventlog when a fax has been added to the Outgoing_Archive, neither does it write to the eventlog when a fax has been sent to the outbox. My guess is that the listeners aren't implemented correctly. This is parts of the code I use

Code:
public Service1()
{
InitializeComponent();
			
objFaxServer.Connect("");
objFaxServer.ListenToServerEvents(FAX_SERVER_EVENTS_TYPE_ENUM.fsetOUT_QUEUE & 
FAX_SERVER_EVENTS_TYPE_ENUM.fsetOUT_ARCHIVE );
this.EventLog.WriteEntry("FaxMonitorComponent Service1() called");	
}

// The main entry point for the process
static void Main()
{

System.ServiceProcess.ServiceBase[] ServicesToRun;
ServicesToRun = new System.ServiceProcess.ServiceBase[] { new Service1() };
System.ServiceProcess.ServiceBase.Run(ServicesToRun);
			
}

private void InitializeComponent()
{
this.objFaxServer = new FaxServerClass();
objFaxServer.OnOutgoingMessageAdded += new FaxServerNotify_OnOutgoingMessageAddedEventHandler(objFaxServer_OnOutgoingMessageAdded);
objFaxServer.OnOutgoingJobAdded += new IFaxServerNotify_OnOutgoingJobAddedEventHandler(objFaxServer_OnOutgoingJobAdded);
					
this.ServiceName = "FaxMonitorComponent";
this.AutoLog = true;
this.CanPauseAndContinue=false;
this.CanStop=true;
}

 
public void objFaxServer_OnOutgoingMessageAdded(FaxServer pFaxServer, string bstrJobId)
{

this.EventLog.WriteEntry("Message sent" );
			
}

public void objFaxServer_OnOutgoingJobAdded(FaxServer pFaxServer, string bstrJobId)
{
try
{
this.EventLog.WriteEntry("Message Added to out que");
}
catch (Exception er)
{
this.EventLog.WriteEntry (er.Message + " " + er.Source+ " " + er.StackTrace);
}

In the eventlog I see that the Service has started OK and is running, but as I mentioned earlier, it doesn't seem to catch the events I want to catch.. Any ideas?

EDIT: Yeah, I've tried to put the eventhandlers in the constructor as well with no success..

Neiden
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top