T
tom Vlaeymans
Hello fax guru's,
I'm lost here....
I'm trying to write a service, that monitors faxjobs.
I've used this code in a classmodule, that should write every change of
faxstatus in a file.
I've tried this in an ordinary application, works like a charm.
When i use this code in a service, running with the same usercredentials as
the application, none of the events are triggered when faxing.
I'm working with winXP pro SP2 and VB6
Any ideas would be apreciated....
Tom
Here's the code:
Dim WithEvents objFaxServer As FAXCOMEXLib.FaxServer
Dim pJobStatus As FAXCOMEXLib.FaxJobStatus
Public Function faxlog(ByVal item1 As String)
Dim fso5, fil5
Set fso5 = CreateObject("Scripting.FileSystemObject")
Set fil5 = fso5.opentextfile("c:\faxlog.txt", 8, True,
filewritemode)
fil5.writeline (CStr(Now) & Chr(9) & item1)
fil5.Close
Set fil5 = Nothing
Set fso5 = Nothing
End Function
Private Sub Class_Initialize()
faxlog "initialising class"
On Error GoTo Error_Handler
Set objFaxServer = New FAXCOMEXLib.FaxServer
faxlog "class is initialised 1"
objFaxServer.connect ("")
faxlog "class is initialised 2"
objFaxServer.ListenToServerEvents fsetOUT_QUEUE
faxlog "class is initialised 3"
faxlog Err.description
Exit Sub
Error_Handler:
faxlog "class is initialised error"
End Sub
Private Sub objFaxServer_OnOutgoingJobAdded(ByVal pFaxServer As
FAXCOMEXLib.IFaxServer, ByVal bstrJobId As String)
faxlog "class OnOutgoingJobAdded 1"
End Sub
Private Sub objFaxServer_OnOutgoingJobChanged(ByVal pFaxServer As
FAXCOMEXLib.IFaxServer, ByVal bstrJobId As String, ByVal pJobStatus As
FAXCOMEXLib.IFaxJobStatus)
On Error GoTo Error_Handler
faxlog "test" '("3 " & pJobStatus.AvailableOperations & _
Exit Sub
Error_Handler:
faxlog ("5 " & "Error number: " & Hex(Err.number) & ", " &
Err.description)
End Sub
Private Sub objFaxServer_OnOutgoingJobRemoved(ByVal pFaxServer As
FAXCOMEXLib.IFaxServer, ByVal bstrJobId As String)
faxlog "test"
End Sub
Private Sub objFaxServer_OnQueuesStatusChange(ByVal pFaxServer As
FAXCOMEXLib.IFaxServer, ByVal bOutgoingQueueBlocked As Boolean, ByVal
bOutgoingQueuePaused As Boolean, ByVal bIncomingQueueBlocked As Boolean)
faxlog "class OnQueuesStatusChange 1"
End Sub
Private Sub objFaxServer_OnServerShutDown(ByVal pFaxServer As
FAXCOMEXLib.IFaxServer)
faxlog "class The local fax server has been shut down"
End Sub
I'm lost here....
I'm trying to write a service, that monitors faxjobs.
I've used this code in a classmodule, that should write every change of
faxstatus in a file.
I've tried this in an ordinary application, works like a charm.
When i use this code in a service, running with the same usercredentials as
the application, none of the events are triggered when faxing.
I'm working with winXP pro SP2 and VB6
Any ideas would be apreciated....
Tom
Here's the code:
Dim WithEvents objFaxServer As FAXCOMEXLib.FaxServer
Dim pJobStatus As FAXCOMEXLib.FaxJobStatus
Public Function faxlog(ByVal item1 As String)
Dim fso5, fil5
Set fso5 = CreateObject("Scripting.FileSystemObject")
Set fil5 = fso5.opentextfile("c:\faxlog.txt", 8, True,
filewritemode)
fil5.writeline (CStr(Now) & Chr(9) & item1)
fil5.Close
Set fil5 = Nothing
Set fso5 = Nothing
End Function
Private Sub Class_Initialize()
faxlog "initialising class"
On Error GoTo Error_Handler
Set objFaxServer = New FAXCOMEXLib.FaxServer
faxlog "class is initialised 1"
objFaxServer.connect ("")
faxlog "class is initialised 2"
objFaxServer.ListenToServerEvents fsetOUT_QUEUE
faxlog "class is initialised 3"
faxlog Err.description
Exit Sub
Error_Handler:
faxlog "class is initialised error"
End Sub
Private Sub objFaxServer_OnOutgoingJobAdded(ByVal pFaxServer As
FAXCOMEXLib.IFaxServer, ByVal bstrJobId As String)
faxlog "class OnOutgoingJobAdded 1"
End Sub
Private Sub objFaxServer_OnOutgoingJobChanged(ByVal pFaxServer As
FAXCOMEXLib.IFaxServer, ByVal bstrJobId As String, ByVal pJobStatus As
FAXCOMEXLib.IFaxJobStatus)
On Error GoTo Error_Handler
faxlog "test" '("3 " & pJobStatus.AvailableOperations & _
Exit Sub
Error_Handler:
faxlog ("5 " & "Error number: " & Hex(Err.number) & ", " &
Err.description)
End Sub
Private Sub objFaxServer_OnOutgoingJobRemoved(ByVal pFaxServer As
FAXCOMEXLib.IFaxServer, ByVal bstrJobId As String)
faxlog "test"
End Sub
Private Sub objFaxServer_OnQueuesStatusChange(ByVal pFaxServer As
FAXCOMEXLib.IFaxServer, ByVal bOutgoingQueueBlocked As Boolean, ByVal
bOutgoingQueuePaused As Boolean, ByVal bIncomingQueueBlocked As Boolean)
faxlog "class OnQueuesStatusChange 1"
End Sub
Private Sub objFaxServer_OnServerShutDown(ByVal pFaxServer As
FAXCOMEXLib.IFaxServer)
faxlog "class The local fax server has been shut down"
End Sub