I've a windows 2000 PC's SP4 and winfax PRO 10.0.
I've developed a faxserver application, which start every X minutes every day. This works fine, except that every 2-3 days, the application hangs on the window ("Converting fax into image"...). So, the next time my application starts, the winfax object is still locked, the word object can't create a new fax, and all application crash. This is my code for sending fax:
'**********************************
Private Function SpedisciFax(rs As Recordset, PrenStr As String) As Boolean
Dim t As Integer
Dim OBJwinFAX As Object
Dim hregkey As Long ' receives handle to the newly created or opened registry key
Dim secattr As SECURITY_ATTRIBUTES ' security settings of the key
Dim subkey As String ' name of the subkey to create
Dim neworused As Long ' receives 1 if new key was created or 2 if an existing key was opened
Dim Ntel As String ' the string to put into the registry
Dim ID As Long ' the string to put into the registry
Dim retval As Long ' return value
On Error GoTo ErrExit
' Writing registry
secattr.nLength = Len(secattr) ' size of the structure
secattr.lpSecurityDescriptor = 0 ' default security level
secattr.bInheritHandle = True ' the default value for this setting
Ntel = Trim(ConvNull(rs!NUMERO_FAX))
ID = Trim(rs!ID)
Debug.Print ID
namefile = "c:\temp\" & Trim(rs!ID) & "_" & Trim(rs!NUMERO_SINISTRO) & ".doc"
WDoc.SaveAs FileName:=namefile, FileFormat:=wdFormatDocument, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
'inserted by WinFaxPro
Set OBJwinFAX = CreateObject("WINFAX.SDKSEND8.0")
OBJwinFAX.SetNumber (Ntel)
OBJwinFAX.setsubject (ID)
OBJwinFAX.SetCompany ("Casa di cura")
OBJwinFAX.AddRecipient
OBJwinFAX.AddAttachmentFile namefile
OBJwinFAX.Send (0)
'inserito dal WinFaxPro
WDoc.Close wdDoNotSaveChanges
WApp.Quit wdDoNotSaveChanges
Set OBJwinFAX = Nothing
Set WDoc = Nothing
Set WApp = Nothing
SpedisciFax = False
Exit Function
ErrExit:
Call ScriviLog("Errore nell'invio a WinFax: " + Str$(Err))
SpedisciFax = True
End Function
'**********************************
I've searched in the forum for topics like this, and I hadn't found nothing exaustive about (i.e.: I release the objwinfax after used; I don't use in this PC Outlook, cause I know that this could generate problems; I've tried to increase the interval settings, i.e. to 1 hour and more... but the problems still remains )
Thank in advance for any help/suggestions
Bye
I've developed a faxserver application, which start every X minutes every day. This works fine, except that every 2-3 days, the application hangs on the window ("Converting fax into image"...). So, the next time my application starts, the winfax object is still locked, the word object can't create a new fax, and all application crash. This is my code for sending fax:
'**********************************
Private Function SpedisciFax(rs As Recordset, PrenStr As String) As Boolean
Dim t As Integer
Dim OBJwinFAX As Object
Dim hregkey As Long ' receives handle to the newly created or opened registry key
Dim secattr As SECURITY_ATTRIBUTES ' security settings of the key
Dim subkey As String ' name of the subkey to create
Dim neworused As Long ' receives 1 if new key was created or 2 if an existing key was opened
Dim Ntel As String ' the string to put into the registry
Dim ID As Long ' the string to put into the registry
Dim retval As Long ' return value
On Error GoTo ErrExit
' Writing registry
secattr.nLength = Len(secattr) ' size of the structure
secattr.lpSecurityDescriptor = 0 ' default security level
secattr.bInheritHandle = True ' the default value for this setting
Ntel = Trim(ConvNull(rs!NUMERO_FAX))
ID = Trim(rs!ID)
Debug.Print ID
namefile = "c:\temp\" & Trim(rs!ID) & "_" & Trim(rs!NUMERO_SINISTRO) & ".doc"
WDoc.SaveAs FileName:=namefile, FileFormat:=wdFormatDocument, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
'inserted by WinFaxPro
Set OBJwinFAX = CreateObject("WINFAX.SDKSEND8.0")
OBJwinFAX.SetNumber (Ntel)
OBJwinFAX.setsubject (ID)
OBJwinFAX.SetCompany ("Casa di cura")
OBJwinFAX.AddRecipient
OBJwinFAX.AddAttachmentFile namefile
OBJwinFAX.Send (0)
'inserito dal WinFaxPro
WDoc.Close wdDoNotSaveChanges
WApp.Quit wdDoNotSaveChanges
Set OBJwinFAX = Nothing
Set WDoc = Nothing
Set WApp = Nothing
SpedisciFax = False
Exit Function
ErrExit:
Call ScriviLog("Errore nell'invio a WinFax: " + Str$(Err))
SpedisciFax = True
End Function
'**********************************
I've searched in the forum for topics like this, and I hadn't found nothing exaustive about (i.e.: I release the objwinfax after used; I don't use in this PC Outlook, cause I know that this could generate problems; I've tried to increase the interval settings, i.e. to 1 hour and more... but the problems still remains )
Thank in advance for any help/suggestions
Bye