471,093 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes and contribute your articles to a community of 471,093 developers and data experts.

How to find the status of fax operation using FAXCOM.dll

111 100+
This article will explain you how to find the status of the fax operation. (Using FAXCOM.dll). Author: Bharath Reddy VasiReddy

Reference to the FAXCOM.DLL

Reference to
Expand|Select|Wrap|Line Numbers
  1. import FAXCOM
  2. import FAXCOMLib 
Tracking The Status of Faxes:

After sending the fax, we need to confirm whether the fax has been sent or not. For this, we need to employ tracking for the status of faxes. In this, if the file gets transmitted in its first attempt of dialing the Faxmodem, the status of the fax Queue will be changed; otherwise it will try two more times (the exact no. of times can be modified programmatically). For this we have to create FaxJob object, which permits a fax client Visual Basic application to access the job status for incoming and outgoing fax transmissions, and to pause, resume, cancel or restart a fax job.

We can also use the object to retrieve information about fax jobs. The information includes, among other items, the fax number to which the fax server will send the transmission, job attributes, and recipient and sender information. There is one FaxJob object for each queued job associated with the server.

Prior to that, we have to call the GetJobs method of the FaxServer object to create a FaxJobs object on the connected fax server. Using the SetStatus method of Fax Status object, we can change the job status of a specified FaxJob object. We can use this method to pause, resume, cancel, or restart a specified fax job.
Expand|Select|Wrap|Line Numbers
  1. Dim FJ As New FaxJobs     
  2. 'to access the job status for incoming    
  3. 'and outgoing fax transmissions   
  4. Dim intCount As Integer  
  5. Dim FJ1 As New FaxJob   
  6.    Set FJ = FS.GetJobs   
  7.    intCount = FJ.Count   
  8. For i = 1 To intCount   
  9.    Set FJ1 = FJ.Item(i)   
  10.    MsgBox "JobId=" & FJ1.JobId   
  11.    MsgBox "QueueStatus   " + FJ1.QueueStatus   
  12. Next I   
  13. Dim FJ As New FaxJobs  
  14. 'to access the job status for incoming 
  15. 'and outgoing fax transmissions
  16. Dim intCount As Integer
  17. Dim FJ1 As New FaxJob
  18. Set FJ = FS.GetJobs
  19. intCount = FJ.Count
  20. For i = 1 To intCount
  21. Set FJ1 = FJ.Item(i)
  22. MsgBox "JobId=" & FJ1.JobId
  23. MsgBox "QueueStatus   " + FJ1.QueueStatus
  24. Next I

Monitoring Port Status:
The Fax Status allows our application to keep track of each stage of a fax’s sending or receiving progress. Using Get Status method of the FaxPort object, we can create Fax Status object. The FaxStatus object permits a fax client Visual Basic application to retrieve status information for a specific port on a connected fax server.

Before that, we have to create FaxPorts object by calling the GetPorts method of the FaxServer object. Using the Receive property of Fax Status object, we can find whether the specified fax port is currently receiving a fax transmission or not. If this property is a nonzero value, the port is currently receiving a fax.

The Send property of FaxStatus object tells us whether the specified fax port is currently sending a fax transmission. If this property is a nonzero value, the port is currently sending a fax.

The sample code for monitoring Fax status as follows:
Expand|Select|Wrap|Line Numbers
  1. Dim FS As New FaxServer    
  2. Dim   FST As New FaxStatus   
  3. Dim FP As New FaxPort   
  4. Dim lReceive As Long  
  5. Dim lSend As Long  
  6.    Set FP = FS.GetPorts   
  7.    Set FST = FP.Item(1)   
  8. lReceive = FP1.Receive   
  9. If lReceive Then  
  10.    MsgBox "port is enabled to receive faxes"  
  11. Else  
  12.    MsgBox "port is not enabled to receive faxes"  
  13. End If  
  14. lSend = FP1.Send   
  15. If  lSend Then  
  16.    MsgBox "port is enabled to Send faxes"  
  17. Else  
  18.    MsgBox "port is not enabled to Send faxes"  
  19. End If  
  20. Dim FS As New FaxServer 
  21. Dim   FST As New FaxStatus
  22. Dim FP As New FaxPort
  23. Dim lReceive As Long
  24. Dim lSend As Long
  25. Set FP = FS.GetPorts
  26. Set FST = FP.Item(1)
  27. lReceive = FP1.Receive
  28. If lReceive Then
  29. MsgBox "port is enabled to receive faxes"
  30. Else
  31. MsgBox "port is not enabled to receive faxes"
  32. End If
  33. lSend = FP1.Send
  34. If  lSend Then
  35. MsgBox "port is enabled to Send faxes"
  36. Else
  37. MsgBox "port is not enabled to Send faxes"
  38. End If
Thanks & Regs
Bharath Reddy VasiReddy
May 22 '07 #1
3 16219
9,735 Expert Mod 8TB
Bharath, thank you for providing such an insight on how to use faxes in .NET!
I'm sure this will be very useful for many people!

May 22 '07 #2

Can you tell me how can i find the port in which fax modem is connected. when i am accessing through network.

I mean to say i need to send a fax which is connected to some other machine.

Pls help
Jan 23 '08 #3
Hi, I was wondering if it's possible to connect many fax modems to a single PC.. then to create multiple objects for every fax modem then send the next fax with the next available faxmodem.. is it possible? any suggestion?

please help
Sep 22 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by jadionne | last post: by
3 posts views Thread by iw3arv | last post: by
reply views Thread by iw3arv | last post: by
1 post views Thread by Divakar | last post: by
9 posts views Thread by pamelafluente | last post: by
1 post views Thread by Bharath Reddy VasiReddy | last post: by
7 posts views Thread by bharathreddy | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.