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
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
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: