Newsgroup: it.comp.lang.visual-basic
Titolo: MS Fax invio fax tramite Visual basic

Ciao a tutti.
ho installato nella mia rete windows server 2003 con il servizio fax.
tutto ok. siccome abbiamo un applicativo sviluppato in vb volevo sapere
se è possibile inviare un fax direttamente dal programma prendendo
come file un allegato e l'informazioni di invio (numero oggetto
frontespizio) da dei dati che ho in alcune tabelle.
grazie 
Alessandro

frontespizio) da dei dati che ho in alcune tabelle.
Ciao io sto cercando di fare qualcosa del genere...perň non posso esserti di 
grande aiuto...
Ti spiego perchč:
girando per la rete ho trovato alcuni esempi interessanti che utilizzano la 
libreria FAXCOMEXLib.dll
Il mio problema č che non ho questa libreria, e non so neanche dove andarla 
a recuperare...quindi non ho mai potuto
dedicarmi alla progettazione di una sorta di applicativo....
Per il resto gli esempi che ho trovato in rete sono molto semplici tanto da 
farmi pensare che
tramite la suddetta libreria non dovrebbe essere cosě complesso creare un 
programmino per mandare fax
con vb....Il problema grosso semmai č che il programmino potrebbe andare con 
certi fax mentre con altri no...
Se sai dove posso reperire la libreria che ti ho citato...fammi un cenno!!!!
Ciao
IAK 

 la libreria FAXCOMEXLib.dll
la libreria a cui fare riferimento č: Microsoft Fax Service Extended COM 
Type Library.

Ti allego un po' di codice
Sub SendingFax()
Dim objFaxServer As FAXCOMEXLib.FaxServer
Dim objFaxDocument As New FAXCOMEXLib.FaxDocument
Dim objFaxJobs As FaxJobs
Dim objFaxJob As FaxJob
Dim JobID As Variant
Dim objFaxPorts As FaxPorts
Dim objFaxPort As FaxPort
Dim objFaxStatus As FaxStatus
Dim objFaxRoutingMethods As FaxRoutingMethods
Dim objFaxRoutingMethod As FaxRoutingMethod
Dim objSender As FaxSender
Dim collFaxDevices As FaxDevices
Dim objFaxDevice As FaxDevice
Dim collFaxDeviceProviders As FaxDeviceProviders
Dim objFaxDeviceProvider As FaxDeviceProvider
Dim i As Variant
Dim j, k, n As Long
'Error handling
On Error GoTo Error_Handler
'Connect to the fax server
Set objFaxServer = New FAXCOMEXLib.FaxServer
'objFaxServer.Connect System.PrivateProfileString("",
"HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Co mputerName\",
"ActiveComputerName")
objFaxServer.Connect ""
Set collFaxDeviceProviders = objFaxServer.GetDeviceProviders
n = collFaxDeviceProviders.Count
'Display the properties for each fax device provider
For j = 1 To n
Set objFaxDeviceProvider = collFaxDeviceProviders.Item(j)
MsgBox "Debug = " & objFaxDeviceProvider.Debug & _
vbCrLf & "Name = " & objFaxDeviceProvider.FriendlyName & _
vbCrLf & "Image name = " & objFaxDeviceProvider.ImageName & _
vbCrLf & "Init error code = " & objFaxDeviceProvider.InitErrorCode & _
vbCrLf & "Build and version = " & objFaxDeviceProvider.MajorBuild & "."
& _
objFaxDeviceProvider.MinorBuild & "." & _
objFaxDeviceProvider.MajorVersion & "." & _
objFaxDeviceProvider.MinorVersion & _
vbCrLf & "Status = " & objFaxDeviceProvider.Status & _
vbCrLf & "Tapi provider = " & objFaxDeviceProvider.TapiProviderName & _
vbCrLf & "Unique name = " & objFaxDeviceProvider.UniqueName
'Display the device ids for that provider
Dim DeviceArray() As Long
DeviceArray = objFaxDeviceProvider.DeviceIds
'UBound finds the size of the array
For k = 0 To UBound(DeviceArray)
MsgBox "Device ID: " & DeviceArray(k)
Next
Next
Set collFaxDevices = objFaxServer.GetDevices
MsgBox "This server has " & collFaxDevices.Count & " fax devices."
For i = 1 To collFaxDevices.Count
Set objFaxDevice = collFaxDevices.Item(i)
objFaxDevice.SendEnabled = True
MsgBox "Device ID for device number " & i & " is: " & objFaxDevice.ID
Next
'Set the fax body
objFaxDocument.Body = "Z:\Triangle\Modčles Triangles\DITO-Convocation du
mardi 08 octobre 2002.doc"
'Name the document
objFaxDocument.DocumentName = "My First Fax"
'Set the fax priority
'objFaxDocument.Priority = fptHIGH
'Add the recipient with the fax number 12225550100
objFaxDocument.Recipients.Add "0149000126", "Bud"
'Choose to attach the fax to the fax receipt
objFaxDocument.AttachFaxToReceipt = True
'Set the cover page type and the path to the cover page
'objFaxDocument.CoverPageType = fcptSERVER
'objFaxDocument.CoverPage = "Generic"
'Provide the cover page note
objFaxDocument.Note = "Here is the info you requested"
'Provide the address for the fax receipt
'objFaxDocument.ReceiptAddress = "
som...@example.com
"
'Set the receipt type to email
'objFaxDocument.ReceiptType = frtMAIL
'Specify that the fax is to be sent at a particular time
'objFaxDocument.ScheduleType = fstSPECIFIC_TIME
'CDate converts the time to the Date data type
'objFaxDocument.ScheduleTime = CDate("4:35:47 PM")
objFaxDocument.Subject = "Today's fax"
'Set the sender properties.
objFaxDocument.Sender.Title = "Mr."
objFaxDocument.Sender.Name
 = "Bob"
objFaxDocument.Sender.City = "Cleveland Heights"
objFaxDocument.Sender.State = "Ohio"
objFaxDocument.Sender.Company = "Microsoft"
objFaxDocument.Sender.Country = "USA"
objFaxDocument.Sender.Email = "
som...@microsoft.com
"
objFaxDocument.Sender.FaxNumber = "
12165555554
"
objFaxDocument.Sender.HomePhone = "
12165555555
"
objFaxDocument.Sender.OfficeLocation = "Downtown"
objFaxDocument.Sender.OfficePhone = "
12165555553
"
objFaxDocument.Sender.StreetAddress = "123 Main Street"
objFaxDocument.Sender.Tsid = "Office fax machine"
objFaxDocument.Sender.ZipCode = "44118"
objFaxDocument.Sender.BillingCode = "23A54"
objFaxDocument.Sender.Department = "Accts Payable"
'Save sender information as default
'objFaxDocument.Sender.SaveDefaultSender
'Submit the document to the connected fax server
'and get back the job ID.
JobID = objFaxDocument.ConnectedSubmit(objFaxServer)
MsgBox "The Job ID is :" & JobID(0)
Exit Sub
Error_Handler:
'Implement error handling at the end of your subroutine. This
implementation is for demonstration purposes
MsgBox "Error number: " & Hex(Err.Number) & ", " & Err.Description
End Sub
Private Sub Form_Load()
Dim objFaxDocument As New FAXCOMEXLib.FaxDocument
Dim objFaxServer As New FAXCOMEXLib.FaxServer
Dim objSender As FaxSender
Dim JobID As Variant
'Error handling
On Error GoTo Error_Handler
'Connect to the fax server
objFaxServer.Connect ""
'Set the fax body
objFaxDocument.Body = "C:\Documents and Settings\giacomo\Desktop\Fano.txt"
'Name the document
objFaxDocument.DocumentName = "My First Fax"
'Set the fax priority
objFaxDocument.Priority = fptHIGH
'Add the recipient with the fax number 12225550100
objFaxDocument.Recipients.Add "12225550100", "Bud"
'Choose to attach the fax to the fax receipt
objFaxDocument.AttachFaxToReceipt = True
'Set the cover page type and the path to the cover page
objFaxDocument.CoverPageType = fcptSERVER
objFaxDocument.CoverPage = "generic"
'Provide the cover page note
objFaxDocument.Note = "Here is the info you requested"
'Provide the address for the fax receipt
objFaxDocument.ReceiptAddress = "
som...@example.com
"
'Set the receipt type to email
objFaxDocument.ReceiptType = frtMAIL
'Specify that the fax is to be sent at a particular time
objFaxDocument.ScheduleType = fstSPECIFIC_TIME
'CDate converts the time to the Date data type
objFaxDocument.ScheduleTime = CDate("4:35:47 PM")
objFaxDocument.Subject = "Today's fax"
'Set the sender properties.
objFaxDocument.Sender.Title = "Mr."
objFaxDocument.Sender.Name
 = "Bob"
objFaxDocument.Sender.City = "Cleveland Heights"
objFaxDocument.Sender.State = "Ohio"
objFaxDocument.Sender.Company = "Microsoft"
objFaxDocument.Sender.Country = "USA"
objFaxDocument.Sender.Email = "
som...@microsoft.com
"
objFaxDocument.Sender.FaxNumber = "
12165555554
"
objFaxDocument.Sender.HomePhone = "
12165555555
"
objFaxDocument.Sender.OfficeLocation = "Downtown"
objFaxDocument.Sender.OfficePhone = "
12165555553
"
objFaxDocument.Sender.StreetAddress = "123 Main Street"
objFaxDocument.Sender.TSID = "Office fax machine"
objFaxDocument.Sender.ZipCode = "44118"
objFaxDocument.Sender.BillingCode = "23A54"
objFaxDocument.Sender.Department = "Accts Payable"
'Save sender information as default
objFaxDocument.Sender.SaveDefaultSender
'Submit the document to the connected fax server
'and get back the job ID.
JobID = objFaxDocument.ConnectedSubmit(objFaxServer)
MsgBox "The Job ID is :" & JobID(0)
Exit Sub
Error_Handler:
'Implement error handling at the end of your subroutine. This implementation 
is for demonstration purposes
MsgBox "Error number: " & Hex(Err.Number) & ", " & Err.Description
End Sub