home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / source / chap25 / vbu2504.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-09-14  |  4.5 KB  |  174 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   " "
  4.    ClientHeight    =   3285
  5.    ClientLeft      =   1095
  6.    ClientTop       =   1500
  7.    ClientWidth     =   5520
  8.    Height          =   3690
  9.    Left            =   1035
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   3285
  12.    ScaleWidth      =   5520
  13.    Top             =   1155
  14.    Width           =   5640
  15.    Begin VB.TextBox Text2 
  16.       Height          =   2115
  17.       Left            =   1440
  18.       MultiLine       =   -1  'True
  19.       ScrollBars      =   2  'Vertical
  20.       TabIndex        =   6
  21.       Text            =   "vbu2504.frx":0000
  22.       Top             =   540
  23.       Width           =   3915
  24.    End
  25.    Begin VB.TextBox Text1 
  26.       Height          =   300
  27.       Left            =   1440
  28.       TabIndex        =   3
  29.       Text            =   "Text1"
  30.       Top             =   120
  31.       Width           =   3915
  32.    End
  33.    Begin VB.CommandButton Command1 
  34.       Caption         =   "E&xit"
  35.       Height          =   300
  36.       Index           =   2
  37.       Left            =   4200
  38.       TabIndex        =   2
  39.       Top             =   2820
  40.       Width           =   1200
  41.    End
  42.    Begin VB.CommandButton Command1 
  43.       Caption         =   "&Cancel"
  44.       Height          =   300
  45.       Index           =   1
  46.       Left            =   2820
  47.       TabIndex        =   1
  48.       Top             =   2820
  49.       Width           =   1200
  50.    End
  51.    Begin VB.CommandButton Command1 
  52.       Caption         =   "&Send"
  53.       Height          =   300
  54.       Index           =   0
  55.       Left            =   1440
  56.       TabIndex        =   0
  57.       Top             =   2820
  58.       Width           =   1200
  59.    End
  60.    Begin MSMAPI.MAPIMessages MAPIMessages1 
  61.       Left            =   240
  62.       Top             =   1800
  63.       _Version        =   65536
  64.       _ExtentX        =   741
  65.       _ExtentY        =   741
  66.       _StockProps     =   0
  67.    End
  68.    Begin MSMAPI.MAPISession MAPISession1 
  69.       Left            =   240
  70.       Top             =   1140
  71.       _Version        =   65536
  72.       _ExtentX        =   741
  73.       _ExtentY        =   741
  74.       _StockProps     =   0
  75.    End
  76.    Begin VB.Label Label2 
  77.       BorderStyle     =   1  'Fixed Single
  78.       Caption         =   "Problem:"
  79.       Height          =   300
  80.       Left            =   120
  81.       TabIndex        =   5
  82.       Top             =   540
  83.       Width           =   1200
  84.    End
  85.    Begin VB.Label Label1 
  86.       BorderStyle     =   1  'Fixed Single
  87.       Caption         =   "Customer:"
  88.       Height          =   300
  89.       Left            =   120
  90.       TabIndex        =   4
  91.       Top             =   120
  92.       Width           =   1200
  93.    End
  94. Attribute VB_Name = "Form1"
  95. Attribute VB_Creatable = False
  96. Attribute VB_Exposed = False
  97. Option Explicit
  98. Private Sub Command1_Click(Index As Integer)
  99.     '
  100.     ' handle user clicks
  101.     '
  102.     Select Case Index
  103.         Case 0
  104.             ' send out report
  105.             DoMAPISend
  106.             ClearForm
  107.         Case 1
  108.             ' cancel this report
  109.             ClearForm
  110.         Case 2
  111.             ' exit this program
  112.             Unload Me
  113.     End Select
  114.     '
  115. End Sub
  116. Private Sub Form_Load()
  117.     DoMAPILogOn
  118.     ClearForm
  119. End Sub
  120. Private Sub Form_Unload(Cancel As Integer)
  121.     DoMAPILogOff
  122. End Sub
  123. Public Sub ClearForm()
  124.     '
  125.     ' clear this form for next input
  126.     '
  127.     Text1 = ""
  128.     Text2 = ""
  129. End Sub
  130. Public Sub DoMAPILogOn()
  131.     '
  132.     ' attempt to log on to mail services
  133.     '
  134.     On Error GoTo DoMAPILogOnErr
  135.     '
  136.     MAPISession1.DownloadMail = False
  137.     MAPISession1.UserName = "MS-Mail Only"
  138.     MAPISession1.SignOn
  139.     MAPIMessages1.SessionID = MAPISession1.SessionID
  140.     Exit Sub
  141.     '
  142. DoMAPILogOnErr:
  143.     MsgBox Error$, vbCritical, "Error Code: " + Str(Err) + " [DoMAPILogOn]"
  144.     Unload Me
  145.     End
  146. End Sub
  147. Public Sub DoMAPILogOff()
  148.     '
  149.     ' log off mapi services
  150.     '
  151.     On Error Resume Next
  152.     MAPISession1.SignOff
  153.     '
  154. End Sub
  155. Public Sub DoMAPISend()
  156.     '
  157.     ' put together message and
  158.     ' ship it out
  159.     '
  160.     On Error GoTo DoMAPISendErr
  161.     '
  162.     MAPIMessages1.Compose
  163.     MAPIMessages1.MsgSubject = "Trouble Report for " + Me.Text1
  164.     MAPIMessages1.MsgNoteText = Me.Text2
  165.     MAPIMessages1.RecipAddress = "MS:COMTRAX/PO1/mca"
  166.     MAPIMessages1.Send
  167.     '
  168.     Exit Sub
  169.     '
  170. DoMAPISendErr:
  171.     MsgBox Error$, vbCritical, "Error Code: " + Str(Err) + " [DoMAPISend]"
  172.     Exit Sub
  173. End Sub
  174.