g_objFaxServer_OnOutgoingJobChanged is not called


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


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,
fil5.writeline (CStr(Now) & Chr(9) & item1)
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
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
On Error GoTo Error_Handler
faxlog "test" '("3 " & pJobStatus.AvailableOperations & _
Exit Sub
faxlog ("5 " & "Error number: " & Hex(Err.number) & ", " &
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
faxlog "class The local fax server has been shut down"
End Sub

Alex Feinman [MVP]

Try checking the box Allow the service to interact with the desktop. If
that fixes it, seriously consider writing a service in something more
suitable for services than VB6. It works very well in C# or VB.NET service
for me.

tom Vlaeymans


Thanks for your quick response!
Allow service to interact with the desktop is no option, because the service
must run as a useraccount.
I'm aware that VB6 isn't the best sollution for writing services, but this
service has been running for a couple of years by now ( it's a pile of
code), and now i've got the "honour" to adapt it for working with win2k3
server, becouse the old method "faxstatus.refresh" isn't accurate anymore.
Time is not on my side, so i'm afraid i'm stuck with VB6 for this one, and
i'm not pleased with it ...

With kind regards,

Alex Feinman [MVP]

tom Vlaeymans said:

Thanks for your quick response!
Allow service to interact with the desktop is no option, because the
service must run as a useraccount.

I did not mean permanently. Just to check the theory

tom Vlaeymans


I've tried that (with another testservice in vb6), but your theory doesn't
seem to work...
No events from faxcomexlib are fired when used in a service.
If you are sure this would work in VB.net, while running as a service, then
i'm afraid there's only one way to go for me: migrate to .net....

With kind regards,
Tom Vlaeymans

Alex Feinman [MVP]

I know it works in the .NET service (C# in my case), because it is what we
are using in production environment. The only thing as I just realized, is
that we are running on Windows 2003, but if memory serves me right, several
years ago when I first written this code I was doing it on XP.

VB6 is not really suited for use in Win32 services so it might be the
reason, but I cannot tell for sure. If you have significant amount of code
in your VB app, consider making an activeX DLL out of it and use it with a
VB.NET service, to avoid time-consuming porting

Raghavendra R [MSFT]

Tom, is 'Windows Firewall' enabled on your system? If so, please check that
your service process (exe file) is in the exceptions list - Start > Control
Panel > Windows Firewall is the place to access firewall settings. Go to the
second tab, Exceptions tab & see if your service exe is present there. If
not choose Add Program to add it & retry your scenario. If this doesn't work
still, for a moment, disable the firewall (select 'Off' on General Tab) &
see if the events are received. This will get Firewall out of the picture.
But please enable the firewall back immediately for security reasons.

Raghavendra R
Microsoft Printing, Imaging and Fax Team
This posting is provided "AS IS" with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.'
Jul 30, 2008
Reaction score
I have the same problem.
I have already done these steps just explained, but the notify don't works.

Any ideas?


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