VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmfax 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Form1"
   ClientHeight    =   8460
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   7830
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   8460
   ScaleWidth      =   7830
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton cmdaboutme 
      Caption         =   "About Me"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   4080
      TabIndex        =   18
      Top             =   7800
      Width           =   1335
   End
   Begin VB.CommandButton cmdexit 
      Caption         =   "Exit"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   5760
      TabIndex        =   17
      Top             =   7800
      Width           =   1335
   End
   Begin MSComDlg.CommonDialog cdlgcoverpage 
      Left            =   2760
      Top             =   8160
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
      DialogTitle     =   "Choose your personal coverpage"
   End
   Begin VB.Frame Frame1 
      Caption         =   "  Fax Information  "
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   7215
      Left            =   360
      TabIndex        =   2
      Top             =   360
      Width           =   7095
      Begin VB.ComboBox cmb1 
         Height          =   315
         ItemData        =   "Form1.frx":0000
         Left            =   1520
         List            =   "Form1.frx":0016
         TabIndex        =   15
         Top             =   1700
         Width           =   735
      End
      Begin VB.TextBox txtsendercompany 
         Height          =   285
         Left            =   1515
         TabIndex        =   14
         Top             =   1320
         Width           =   3255
      End
      Begin VB.TextBox txtfax 
         Height          =   285
         Left            =   1515
         TabIndex        =   12
         Top             =   840
         Width           =   3255
      End
      Begin VB.TextBox txtsendername 
         Height          =   285
         Left            =   1515
         TabIndex        =   10
         Top             =   360
         Width           =   3255
      End
      Begin VB.TextBox txtbody 
         Height          =   3855
         Left            =   1515
         MultiLine       =   -1  'True
         TabIndex        =   5
         Top             =   3120
         Width           =   5175
      End
      Begin VB.TextBox txtsubject 
         Height          =   285
         Left            =   1515
         TabIndex        =   4
         Top             =   2640
         Width           =   5175
      End
      Begin VB.TextBox txttel 
         Height          =   285
         Left            =   1515
         TabIndex        =   3
         Top             =   2160
         Width           =   1695
      End
      Begin VB.Label Label3 
         Caption         =   "Retries :"
         Height          =   255
         Left            =   840
         TabIndex        =   16
         Top             =   1680
         Width           =   615
      End
      Begin VB.Label Label7 
         Caption         =   "Sender Company :"
         Height          =   255
         Left            =   120
         TabIndex        =   13
         Top             =   1320
         Width           =   1335
      End
      Begin VB.Label Label6 
         Caption         =   "Sender Fax No :"
         Height          =   255
         Left            =   255
         TabIndex        =   11
         Top             =   840
         Width           =   1215
      End
      Begin VB.Label Label5 
         Caption         =   "Sender Name :"
         Height          =   255
         Left            =   315
         TabIndex        =   9
         Top             =   360
         Width           =   1095
      End
      Begin VB.Label Label1 
         Caption         =   "Note :"
         Height          =   255
         Left            =   1035
         TabIndex        =   8
         Top             =   3120
         Width           =   615
      End
      Begin VB.Label Label2 
         Caption         =   "Subject :"
         Height          =   255
         Left            =   795
         TabIndex        =   7
         Top             =   2640
         Width           =   735
      End
      Begin VB.Label Label4 
         Caption         =   "Fax No :"
         Height          =   255
         Left            =   795
         TabIndex        =   6
         Top             =   2160
         Width           =   615
      End
   End
   Begin VB.CommandButton cmdcp 
      Caption         =   "Coverpage"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2400
      TabIndex        =   1
      Top             =   7800
      Width           =   1335
   End
   Begin VB.CommandButton cmdsend 
      Caption         =   "Send Fax"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   9
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   720
      TabIndex        =   0
      Top             =   7800
      Width           =   1335
   End
End
Attribute VB_Name = "frmfax"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub fax()

Dim objFaxServer As New FAXCOMEXLib.FaxServer
Dim objFaxDocument As New FAXCOMEXLib.FaxDocument
Dim objFaxDevice As FaxDevice
Dim ID As Long
Dim objSender As FaxSender
Dim JobID As Variant
Dim a As Integer

objFaxServer.Connect ""

Set objFaxActivity = objFaxServer.Activity
Set objFaxDevice = objFaxServer.GetDevices.Item(1)


 
' Connect to the fax server.
' "" defaults to the server on which the script is running.
MsgBox objFaxActivity.IncomingMessages & " Incoming Messages"
MsgBox objFaxActivity.OutgoingMessages & " Outgoing Messages"
MsgBox objFaxActivity.RoutingMessages & " Routing Messages"
MsgBox objFaxActivity.QueuedMessages & " Queued Messages"
'Connect to the fax server.
objFaxServer.Connect ""
'Get the device.
objFaxDevice.Description = "Device Number 1"
'Set the device to answer automatically.
objFaxDevice.ReceiveMode = fdrmAUTO_ANSWER
'Set the number of rings before the device answers.
objFaxDevice.RingsBeforeAnswer = 5
'Enable Send
objFaxDevice.SendEnabled = True
'Save the device configuration.
objFaxDevice.Save
'Get the device ID.
ID = objFaxDevice.ID
'Set the branding property.
objFaxServer.Folders.OutgoingQueue.Branding = False
'Save the change.
objFaxServer.Folders.OutgoingQueue.Save
objFaxServer.Folders.OutgoingQueue.AgeLimit = 2
a = cmb1.Text
objFaxServer.Folders.OutgoingQueue.Retries = a
objFaxServer.Folders.OutgoingQueue.Save

'Set the fax body.
'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 (txttel.Text)

'Set the sender properties.
objFaxDocument.Sender.Name = txtsendername.Text
objFaxDocument.Sender.FaxNumber = txtfax.Text
objFaxDocument.Sender.Company = txtsendercompany.Text
objFaxDocument.Subject = txtsubject.Text
objFaxDocument.Note = txtbody.Text
objFaxDocument.CoverPageType = fcptLOCAL
objFaxDocument.CoverPage = cdlgcoverpage.FileName

'Submit the document to the connected fax server
'and get back the job ID.objFaxDocument

JobID = objFaxDocument.Submit("")
MsgBox "The Job ID is :" & JobID(0)

End Sub

Private Sub cmdaboutme_Click()
frmaboutme.Show
End Sub

Private Sub cmdcp_Click()
With cdlgcoverpage
    .Filter = "CoverPage File Extension |*.cov"
    .ShowOpen
End With
End Sub

Private Sub cmdexit_Click()
End
End Sub

Private Sub cmdsend_Click()
If cdlgcoverpage.FileName = "" Then
MsgBox "You must choose a coverpage"
Else
fax
End If

End Sub

