FaxMan Jr
Event and Status Objects

 

It’s great that FaxMan Jr. makes sending faxes so easy...but how the heck does your application have any idea what FaxMan Jr. is doing at any given time? The answer to this, of course, is FaxMan Jr. events and the Status Object.

 

FaxMan Jr. fires events in your application at various milestones during the sending process (and receiving process, as you’ll see later). These events are as follows:

 

Status – fired during the sending (or receiving) process to give your app up to the second information on the current send or receive operation.

 

NegotiatedParms – fired when the fax devices have completed negotiations for the current fax session. The RemoteID is also valid at this stage of the process.

 

Pages – notifies your app of the number of pages sent/received.

 

StartTime – fired when the fax process is begun.

 

EndTime – fired when the fax process ends.

 

CompletionStatus – fired at the end of the faxing process to indicate that your app can check the status object to determine the overall success of the fax process.

 

Message – fired for messages sent to and received from the faxmodem. Also used to output debug messages during sending/receiving. Your app can choose to monitor these strings or may just disregard them.

 

Ring – fired when listening for rings. Your app can choose to answer the ring or simply continue listening.

 

ReceiveFileName – fired during fax reception when the receive filename has been created.

 

In addition, FaxMan Jr. keeps track of the current state of the faxing process in an object called the Status object. This object is passed to several FaxMan Jr. notification events so that your application can determine FaxMan Jr. status at these times. The Status Object has the following members:

 

RemoteID – a string that identifies the remote fax device.

 

ConnectSpeed – an Integer containing the negotiated speed of the faxing process (300 – 14400).

 

NegotiatedResolution – an Integer containing the negotiated resolution of the fax process (0 for low, 1 for high).

 

CurrentStatus – an Integer which contains the current status of a fax send/receive operation.

 

CurrentStatusDesc – a String which contains the current status of a fax send/receive operation.

 

StartTime – a DWORD containing the start time of the current fax operation (i.e., when the phone is taken off-hook). This is expressed in seconds elapsed since midnight, January 1, 1970.

 

EndTime – like StartTime, but specifies the time a fax process ended (i.e., when the phone is hung up).

 

ReceiveFileName – a string that identifies the name of the received fax file.

 

Pages – Integer which specifies the total number of pages in the current fax operation.

 

PagesCompleted – an Integer which indicates the number of pages successfully completed in the current fax operation.

 

ErrorCode – an Integer which specifies the current error status.

 

ErrorDesc – a string which describes the current error status.

 

LastEventType – an Integer which identifies which type of event was last fired. This is normally used only for applications which cannot process events, and which must use the WaitForEvent method to watch events.

 

The Status Object is passed to the following events:

 

Status

NegotiatedParms

Pages

StartTime

EndTime

CompletionStatus

ReceiveFileName

 

You may refer to any of the Status Object’s properties from within any of these event handlers. The example below is an excerpt from an application and illustrates how the Status Object is used in several event handlers:

 

 

Private Sub faxctl1_CompletionStatus(ByVal pStatObj As FaxmanJrCtl.IfaxStatusObj)

ErrStat.Caption = "Error Status: " + Str$(pStatObj.ErrorCode) 

End Sub

 

Private Sub faxctl1_Pages(ByVal pStatObj As FaxmanJrCtl.IfaxStatusObj)

Pages.Caption = "Pages: " & Str(pStatObj.PagesCompleted) & " of " & Str(pStatObj.Pages) 

Text1.SelText = "Pages: " & Str(pStatObj.PagesCompleted) & " of " & Str(pStatObj.Pages) & vbCrLf 

End Sub

 

Private Sub faxctl1_ReceiveFileName(ByVal pStatObj As FaxmanJrCtl.IfaxStatusObj)

Text1.SelText = "Receive File Name: " & pStatObj.ReceiveFileName & vbCrLf 

ErrStat.Caption = "Receive File Name: " & pStatObj.ReceiveFileName 

End Sub

 

Private Sub faxctl1_NegotiatedParms(ByVal pStatObj As FaxmanJrCtl.IfaxStatusObj)

Speed.Caption = pStatObj.ConnectSpeed 

If pStatObj.NegotiatedResolution = 0 Then 

Resolution.Caption = "Low" 

Else 

Resolution.Caption = "High" 

End If 

RemoteID.Caption = pStatObj.RemoteID 

End Sub

 

Private Sub faxctl1_Status(ByVal pStatObj As FaxmanJrCtl.IfaxStatusObj)

 

Text1.SelText = "Status: " + Str(pStatObj.CurrentStatus) + vbCrLf 

Status.Caption = pStatObj.CurrentStatusDesc

 

Status.Refresh

End Sub

 

You can find information on individual event callback functions in the reference section.

 

 


© 2014 Data Techniques, Inc. All Rights Reserved.

Send comments on this topic.