Example projects are included with the installation of VBFax. These examples are located in the Examples subdirectory of the VBFax install directory.
SendFax Example: Uses the SendFax control and faxes an attachment file along with a cover page to a fax number provided by a caller.
SameCallFax Example: Shows how to use the SendFax and ReceiveFax controls to make a basic send and receive fax application.
Server, QueueApp, ActivityLog, Configure: A complete fax queue solution that can be run as-is or modified to suit your applications fax queuing requirements.
Using the VBVoice SendFax control, this example faxes an attachment file along with a cover page to a fax number provided by the caller.
This example shows how VBFax can be integrated into a VBVoice application. The SendFax control is featured in this example, which prompts the user for a fax and attachment number, to which a fax is sent.
When an incoming call is detected, the caller is prompted for a fax number. Then the user specifies an attachment file number.
The file number represents a file in C:\vbfax32 of the form fax#.txt, where. # represents a number of 1 to 9. Up to nine file attachments can be specified. Upon pressing *, the fax is sent.
The first GetDigits, named GetFaxNum, gets the digits for the Recipients Fax Number. The second GetDigits, named GetDigits1, allows the user to verify and correct the inputted numbers and to proceed to the next GetDigits.
GetFaxNum allows no maximum number of digits as long as there is a minimum of 7 (defined by code at Run time). It terminates with 10 seconds of silence or # character.
This of course is intentional due to long distance, area codes and overseas clients. See below.
Private Sub GetFaxNum_Condition(ByVal Channel As Integer, Decided As
Integer, Node As Integer)
' validate the
fax number
faxnum = GetFaxNum.Digits(Channel)
Debug.Print faxnum
If Len(faxnum) >= 7 Then
Decided = True
End If
End Sub
GetDocNum receives the file attachment number input by the user. This GetDigits control is setup to accept all single digits from 1 to 9 inclusively. This is setup in the GetDocNum property pages shown below.
The SendFax example will allow you to cycle through and select several attachment one after the other. The * character sends the request through to the SendFax EnterB event to the VBFaxServer object. .
This control provides the ability to send one or more faxes while performing voice processing on a VBVoice channel.
You must specify the name of the FaxServer and the Destination Fax Number. For more detailed explanation of the SendFax control, please examine the SendFax Control Property page.
The EnterB event is fired on entry to the control via the second input node of the SendFax control. This is the Send node. Use the EnterB event to change runtime properties prior to sending of the fax. Control will exit through either the Sent or Error output nodes of the control.
In the SendFax1 Property Pages, Destination tab. You must specify the Fax: destination number. Use the Reference button to select from the Available controls. Select GetFaxNum (GetDigits control), drag and drop Digits from the Available Properties to the Fax: text box.
Or if you prefer, just print %GetFaxNum.Digits% in the Fax: text box.
In the SendFax1 Property Pages, Document tab, you must specify the path, name and file extension of the document:
C:\vbfax32\examples\SendFax\fax%GetDocNum.Digits%.txt
The name of the faxing document can be fax1.txt, the %GetDocNum.Digits% gets the file attachment number (1 to 9 inclusively) and adds it to the file name. Example fax1.txt or fax8.txt.
Of note in this example is the use of the two Visual Basic command buttons, START and STOP as well as the Private Sub GetFaxNum_Condition which we looked at previously.
The START and STOP Visual Basic command buttons execute the StartSystem and StopSystem.
When Visual Basic is in run mode, the Start System menu item is enabled. Start System performs the same function as the VBVFrame method StartSystem(). It checks all the controls, loads the voice card driver, and starts voice operations. It also displays the Line Status window and the log window for channel 1, unlike the StartSystem method.
The StartSystem is accomplished at run time by this code
VBVFrame1.StartSystem (True)
Once the system is started, you can stop voice operations with Stop System.
Equivalent to the VBVFrame method StartSystem (False). Normally VBVoice waits for all lines to clear before terminating. The Line Status window appears and marks all idle lines as: Waiting for Termination.
The StopSystem is accomplished at run time by this code
VBVFrame1.StopSystem(True)
Code Window
Command1 Visual Basic button START.
Starts the system and does some error checking and prints the Error and Error Description to the Debug window.
Private Sub Command1_Click()
On Error GoTo start_err
VBVFrame1.StartSystem (True)
Exit Sub
start_err:
Debug.Print "Error on starting system = " + Str$(Err) + "
" + Err.Description
Resume Next
End Sub
Command2 Visual Basic button STOP
Stops the system and does some error checking and prints the Error and Error Description to the Debug window.
Private Sub Command2_Click()
On Error GoTo stop_err
VBVFrame1.StopSystem(True)
Exit Sub
stop_err:
Debug.Print "Error on stopping system = " + Str$(Err) + "
" + Err.Description
Resume Next
End Sub
This example shows how to use the SendFax and ReceiveFax controls.
The LineGroup1 control is set to Wait For Ring mode. When an incoming call arrives, the LineGroup control will answer the call in the usual way and transfer the call via the ring output to the ReceiveFax control.
The ReceiveFax control is set to receive a file named *.tif. Since no directory is specified, the default FaxIn directory (C:\Program Files\Pronexus\VBVoice\faxin) will be used. A unique file name will be generated for this fax, and fax reception commences.
When fax reception terminates, code in the exit event checks the status of the fax and prints this information to the Visual Basic debug window. In a real application, this may be used to send the fax via email to a recipient, and/or to maintain a log of fax activity.
To cause the system to send a fax, press the SendFax button. This will execute the StartCall method on the LineGroup control, and the new call will exit out of the StartCall output. The call enters into the Send input of the SendFax control, bypassing the Add input. For simplicity, the SendFax is configured to send only a cover page, with no additional documents. As with the ReceiveFax control, after the transmission is complete, information about the fax status is printed to the Visual Basic debug window.
In VBVoice 5.1 the FaxQueue control was retired from the VBFax toolkit. Pronexus now offers the following examples which serve as a complimentary Fax Queue Solution.
This Fax Queue Solution is built upon existing VBFax objects and is provided as a series of VB6 examples, which, when run simultaneously, provide fax queuing functionality. Each example has a particular role in the overall solution:
Server: This DLL provides the internal queuing services for outgoing fax requests. This program resides on the system as a DLL that maintains a database of fax jobs to be processed and fax jobs that were delivered.
Configure: This is a configuration utility for the Fax Queue Solution. In this example, configuration is done on two levels:
System wide: Settings such as the number of fax lines, analog/digital connection type, and type of resources (such as Dialogic Springware ors Gammalink fax-only resources) can be set.
Document specific: In this example, fax jobs are manually added to the queue with necessary information elements, such as the recipients name and fax number, and the senders company and contact information. Additionally, document specific parameters such as fax defer time, priority in the queue, retry information, and coarse/fine print resolution are available.
ActivityLog: This application reports the fax queue activity, and provides information about the fax ID, end delivery results, and queued fax job timestamps. Other options include searching for a particular job ID and purging activity logs.
QueueApp: This component of the Fax Queue Solution is responsible for the physical delivery of the fax to the recipient address. This application will seize a channel on the Dialogic card and send a fax according to the configuration information. There is limited user interaction with this portion of the queue.