本文将向您解释如何查找传真操作的状态。 (使用FAXCOM.dll)。 作者:巴拉特·雷迪(Bharath Reddy)VasiReddy
引用到FAXCOM.DLL
参考
import FAXCOM
import FAXCOMLib
跟踪传真状态:
发送传真后,我们需要确认是否已发送传真。 为此,我们需要对传真状态进行跟踪。 在这种情况下,如果文件是在第一次尝试拨打Faxmodem时被发送的,则传真队列的状态将被更改; 否则,它将尝试两次以上(可以通过编程方式修改确切的次数)。 为此,我们必须创建FaxJob对象,该对象允许传真客户端Visual Basic应用程序访问传入和传出传真传输的作业状态,以及暂停,继续,取消或重新启动传真作业。
我们还可以使用该对象来检索有关传真作业的信息。 该信息除其他项目外,还包括传真服务器将向其发送传输的传真号码,作业属性以及收件人和发件人信息。 与服务器关联的每个排队的作业都有一个FaxJob对象。
在此之前,我们必须调用FaxServer对象的GetJobs方法在连接的传真服务器上创建一个FaxJobs对象。 使用传真状态对象的SetStatus方法,我们可以更改指定的FaxJob对象的作业状态。 我们可以使用此方法暂停,恢复,取消或重新启动指定的传真作业。
Dim FJ As New FaxJobs
'to access the job status for incoming
'and outgoing fax transmissions
Dim intCount As Integer
Dim FJ1 As New FaxJob
Set FJ = FS.GetJobs
intCount = FJ.Count
For i = 1 To intCount
Set FJ1 = FJ.Item(i)
MsgBox "JobId=" & FJ1.JobId
MsgBox "QueueStatus " + FJ1.QueueStatus
Next I
Dim FJ As New FaxJobs
'to access the job status for incoming
'and outgoing fax transmissions
Dim intCount As Integer
Dim FJ1 As New FaxJob
Set FJ = FS.GetJobs
intCount = FJ.Count
For i = 1 To intCount
Set FJ1 = FJ.Item(i)
MsgBox "JobId=" & FJ1.JobId
MsgBox "QueueStatus " + FJ1.QueueStatus
Next I
监控端口状态:
传真状态允许我们的应用程序跟踪传真发送或接收进度的每个阶段。 使用FaxPort对象的Get Status方法,我们可以创建Fax Status对象。 FaxStatus对象允许传真客户端Visual Basic应用程序检索连接的传真服务器上特定端口的状态信息。
在此之前,我们必须通过调用FaxServer对象的GetPorts方法来创建FaxPorts对象。 使用“传真状态”对象的“接收”属性,我们可以找到指定的传真端口当前是否正在接收传真传输。 如果此属性为非零值,则表明该端口当前正在接收传真。
FaxStatus对象的Send属性告诉我们指定的传真端口当前是否正在发送传真传输。 如果此属性为非零值,则表明该端口当前正在发送传真。
用于监视传真状态的示例代码如下:
Dim FS As New FaxServer
Dim FST As New FaxStatus
Dim FP As New FaxPort
Dim lReceive As Long
Dim lSend As Long
Set FP = FS.GetPorts
Set FST = FP.Item(1)
lReceive = FP1.Receive
If lReceive Then
MsgBox "port is enabled to receive faxes"
Else
MsgBox "port is not enabled to receive faxes"
End If
lSend = FP1.Send
If lSend Then
MsgBox "port is enabled to Send faxes"
Else
MsgBox "port is not enabled to Send faxes"
End If
Dim FS As New FaxServer
Dim FST As New FaxStatus
Dim FP As New FaxPort
Dim lReceive As Long
Dim lSend As Long
Set FP = FS.GetPorts
Set FST = FP.Item(1)
lReceive = FP1.Receive
If lReceive Then
MsgBox "port is enabled to receive faxes"
Else
MsgBox "port is not enabled to receive faxes"
End If
lSend = FP1.Send
If lSend Then
MsgBox "port is enabled to Send faxes"
Else
MsgBox "port is not enabled to Send faxes"
End If
谢谢和Regs
巴拉斯·雷迪VasiReddy
eXensys
From: https://bytes.com/topic/net/insights/650334-how-find-status-fax-operation-using-faxcom-dll