home *** CD-ROM | disk | FTP | other *** search
/ Master 95 #1 / MASTER95_1.iso / microsof / vbasic4 / vb4-6.cab / vbmail.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-07-26  |  19.8 KB  |  617 lines

  1. VERSION 4.00
  2. Begin VB.MDIForm VBMAIL 
  3.    BackColor       =   &H8000000C&
  4.    Caption         =   "VB Mail"
  5.    ClientHeight    =   6090
  6.    ClientLeft      =   375
  7.    ClientTop       =   1995
  8.    ClientWidth     =   9195
  9.    Height          =   6780
  10.    Icon            =   "VBMAIL.frx":0000
  11.    Left            =   315
  12.    Top             =   1365
  13.    Width           =   9315
  14.    Begin VB.PictureBox Picture1 
  15.       Align           =   2  'Align Bottom
  16.       BackColor       =   &H00C0C0C0&
  17.       BorderStyle     =   0  'None
  18.       Enabled         =   0   'False
  19.       Height          =   330
  20.       Left            =   0
  21.       ScaleHeight     =   330
  22.       ScaleWidth      =   9195
  23.       TabIndex        =   0
  24.       Top             =   5760
  25.       Width           =   9195
  26.       Begin VB.Line MsgBoxSide 
  27.          BorderColor     =   &H00FFFFFF&
  28.          Index           =   1
  29.          X1              =   7260
  30.          X2              =   7260
  31.          Y1              =   60
  32.          Y2              =   300
  33.       End
  34.       Begin VB.Line MsgBoxSide 
  35.          BorderColor     =   &H00808080&
  36.          Index           =   0
  37.          X1              =   60
  38.          X2              =   60
  39.          Y1              =   60
  40.          Y2              =   300
  41.       End
  42.       Begin VB.Line MsgBoxLine 
  43.          BorderColor     =   &H00FFFFFF&
  44.          Index           =   1
  45.          X1              =   60
  46.          X2              =   7260
  47.          Y1              =   300
  48.          Y2              =   300
  49.       End
  50.       Begin VB.Line MsgBoxLine 
  51.          BorderColor     =   &H00808080&
  52.          Index           =   0
  53.          X1              =   60
  54.          X2              =   7260
  55.          Y1              =   60
  56.          Y2              =   60
  57.       End
  58.       Begin VB.Line TimeBoxSide 
  59.          BorderColor     =   &H00FFFFFF&
  60.          Index           =   1
  61.          X1              =   8580
  62.          X2              =   8580
  63.          Y1              =   60
  64.          Y2              =   300
  65.       End
  66.       Begin VB.Line TimeBoxLine 
  67.          BorderColor     =   &H00FFFFFF&
  68.          Index           =   1
  69.          X1              =   7320
  70.          X2              =   8580
  71.          Y1              =   300
  72.          Y2              =   300
  73.       End
  74.       Begin VB.Line TimeBoxSide 
  75.          BorderColor     =   &H00808080&
  76.          Index           =   0
  77.          X1              =   7320
  78.          X2              =   7320
  79.          Y1              =   60
  80.          Y2              =   300
  81.       End
  82.       Begin VB.Line TimeBoxLine 
  83.          BorderColor     =   &H00808080&
  84.          Index           =   0
  85.          X1              =   7320
  86.          X2              =   8580
  87.          Y1              =   60
  88.          Y2              =   60
  89.       End
  90.       Begin VB.Line TopLine2 
  91.          BorderColor     =   &H00FFFFFF&
  92.          Index           =   1
  93.          X1              =   0
  94.          X2              =   10800
  95.          Y1              =   15
  96.          Y2              =   15
  97.       End
  98.       Begin VB.Label UnreadLbl 
  99.          BackStyle       =   0  'Transparent
  100.          Height          =   255
  101.          Left            =   3000
  102.          TabIndex        =   7
  103.          Top             =   60
  104.          Width           =   1575
  105.       End
  106.       Begin VB.Line TopLine2 
  107.          BorderColor     =   &H00000000&
  108.          Index           =   0
  109.          X1              =   0
  110.          X2              =   10800
  111.          Y1              =   0
  112.          Y2              =   0
  113.       End
  114.       Begin VB.Label TimeLbl 
  115.          AutoSize        =   -1  'True
  116.          BackStyle       =   0  'Transparent
  117.          Caption         =   "Time"
  118.          Height          =   205
  119.          Left            =   7500
  120.          TabIndex        =   10
  121.          Top             =   75
  122.          Width           =   345
  123.       End
  124.       Begin VB.Label MsgCountLbl 
  125.          AutoSize        =   -1  'True
  126.          BackStyle       =   0  'Transparent
  127.          Caption         =   "Message Count Information"
  128.          Height          =   195
  129.          Left            =   120
  130.          TabIndex        =   11
  131.          Top             =   75
  132.          Width           =   1935
  133.       End
  134.    End
  135.    Begin VB.PictureBox Picture3 
  136.       Align           =   1  'Align Top
  137.       Height          =   855
  138.       Left            =   0
  139.       ScaleHeight     =   825
  140.       ScaleWidth      =   9165
  141.       TabIndex        =   8
  142.       Top             =   525
  143.       Visible         =   0   'False
  144.       Width           =   9195
  145.       Begin VB.Timer Timer1 
  146.          Interval        =   15000
  147.          Left            =   180
  148.          Top             =   120
  149.       End
  150.       Begin MSMAPI.MAPIMessages MapiMess 
  151.          Left            =   1320
  152.          Top             =   120
  153.          _version        =   65536
  154.          _extentx        =   741
  155.          _extenty        =   741
  156.          _stockprops     =   0
  157.          addresseditfieldcount=   0
  158.          fetchunreadonly =   -1  'True
  159.       End
  160.       Begin MSMAPI.MAPISession MapiSess 
  161.          Left            =   720
  162.          Top             =   120
  163.          _version        =   65536
  164.          _extentx        =   741
  165.          _extenty        =   741
  166.          _stockprops     =   0
  167.       End
  168.       Begin MSComDlg.CommonDialog CMDialog1 
  169.          Left            =   1920
  170.          Top             =   120
  171.          _version        =   65536
  172.          _extentx        =   847
  173.          _extenty        =   847
  174.          _stockprops     =   0
  175.          cancelerror     =   -1  'True
  176.       End
  177.       Begin VB.Label Label1 
  178.          Caption         =   "These controls are invisible at run time."
  179.          Height          =   315
  180.          Left            =   2700
  181.          TabIndex        =   9
  182.          Top             =   300
  183.          Width           =   2835
  184.       End
  185.    End
  186.    Begin VB.PictureBox Picture2 
  187.       Align           =   1  'Align Top
  188.       BackColor       =   &H00C0C0C0&
  189.       BorderStyle     =   0  'None
  190.       Height          =   525
  191.       Left            =   0
  192.       ScaleHeight     =   525
  193.       ScaleWidth      =   9195
  194.       TabIndex        =   12
  195.       Top             =   0
  196.       Width           =   9195
  197.       Begin VB.CommandButton Delete 
  198.          Caption         =   "&Delete"
  199.          Enabled         =   0   'False
  200.          Height          =   330
  201.          Left            =   4980
  202.          TabIndex        =   4
  203.          Top             =   90
  204.          Width           =   1035
  205.       End
  206.       Begin VB.CommandButton Next 
  207.          Caption         =   "&Next"
  208.          Enabled         =   0   'False
  209.          Height          =   330
  210.          Left            =   7440
  211.          TabIndex        =   6
  212.          Top             =   90
  213.          Width           =   1035
  214.       End
  215.       Begin VB.CommandButton Previous 
  216.          Caption         =   "&Previous"
  217.          Enabled         =   0   'False
  218.          Height          =   330
  219.          Left            =   6420
  220.          TabIndex        =   5
  221.          Top             =   90
  222.          Width           =   1035
  223.       End
  224.       Begin VB.CommandButton SendCtl 
  225.          Caption         =   "&Forward"
  226.          Enabled         =   0   'False
  227.          Height          =   330
  228.          Index           =   9
  229.          Left            =   3600
  230.          TabIndex        =   3
  231.          Top             =   90
  232.          Width           =   1035
  233.       End
  234.       Begin VB.CommandButton SendCtl 
  235.          Caption         =   "Reply &All"
  236.          Enabled         =   0   'False
  237.          Height          =   330
  238.          Index           =   8
  239.          Left            =   2580
  240.          TabIndex        =   2
  241.          Top             =   90
  242.          Width           =   1035
  243.       End
  244.       Begin VB.CommandButton SendCtl 
  245.          Caption         =   "&Reply"
  246.          Enabled         =   0   'False
  247.          Height          =   330
  248.          Index           =   7
  249.          Left            =   1560
  250.          TabIndex        =   1
  251.          Top             =   90
  252.          Width           =   1035
  253.       End
  254.       Begin VB.CommandButton SendCtl 
  255.          Caption         =   "&Compose"
  256.          Enabled         =   0   'False
  257.          Height          =   330
  258.          Index           =   6
  259.          Left            =   180
  260.          TabIndex        =   13
  261.          Top             =   90
  262.          Width           =   1035
  263.       End
  264.       Begin VB.Line TopLine 
  265.          BorderColor     =   &H00000000&
  266.          Index           =   1
  267.          X1              =   15
  268.          X2              =   10800
  269.          Y1              =   505
  270.          Y2              =   505
  271.       End
  272.       Begin VB.Line Line1 
  273.          BorderColor     =   &H00FFFFFF&
  274.          X1              =   0
  275.          X2              =   0
  276.          Y1              =   0
  277.          Y2              =   540
  278.       End
  279.       Begin VB.Line TopLine 
  280.          BorderColor     =   &H00FFFFFF&
  281.          Index           =   0
  282.          X1              =   0
  283.          X2              =   10800
  284.          Y1              =   0
  285.          Y2              =   0
  286.       End
  287.    End
  288.    Begin VB.Menu FileMenu 
  289.       Caption         =   "&File"
  290.       Begin VB.Menu PrintMessage 
  291.          Caption         =   "&Print Message"
  292.          Enabled         =   0   'False
  293.       End
  294.       Begin VB.Menu PrSetup 
  295.          Caption         =   "Prin&ter Setup..."
  296.       End
  297.       Begin VB.Menu sep 
  298.          Caption         =   "-"
  299.       End
  300.       Begin VB.Menu Exit 
  301.          Caption         =   "E&xit"
  302.       End
  303.    End
  304.    Begin VB.Menu EditMenu 
  305.       Caption         =   "&Edit"
  306.       Begin VB.Menu EditDelete 
  307.          Caption         =   "Delete"
  308.          Enabled         =   0   'False
  309.       End
  310.    End
  311.    Begin VB.Menu Mail 
  312.       Caption         =   "&Mail"
  313.       Begin VB.Menu Logon 
  314.          Caption         =   "Lo&gon"
  315.       End
  316.       Begin VB.Menu LogOff 
  317.          Caption         =   "Log&off"
  318.          Enabled         =   0   'False
  319.       End
  320.       Begin VB.Menu sep2 
  321.          Caption         =   "-"
  322.       End
  323.       Begin VB.Menu rMsgList 
  324.          Caption         =   "Update Message List"
  325.          Enabled         =   0   'False
  326.       End
  327.    End
  328.    Begin VB.Menu Options 
  329.       Caption         =   "&Options"
  330.       Begin VB.Menu MailOpts 
  331.          Caption         =   "&Mail..."
  332.       End
  333.       Begin VB.Menu FontS 
  334.          Caption         =   "&Fonts"
  335.          Begin VB.Menu FontScreen 
  336.             Caption         =   "&Screen..."
  337.          End
  338.          Begin VB.Menu FontPrt 
  339.             Caption         =   "&Printer..."
  340.          End
  341.       End
  342.       Begin VB.Menu DispTools 
  343.          Caption         =   "&Display Tools"
  344.          Checked         =   -1  'True
  345.          Enabled         =   0   'False
  346.       End
  347.    End
  348.    Begin VB.Menu Address 
  349.       Caption         =   "&Address"
  350.       Begin VB.Menu ShowAB 
  351.          Caption         =   "Show Address Book"
  352.       End
  353.    End
  354.    Begin VB.Menu Window 
  355.       Caption         =   "Window"
  356.       WindowList      =   -1  'True
  357.       Begin VB.Menu wa 
  358.          Caption         =   "&Cascade"
  359.          Index           =   0
  360.       End
  361.       Begin VB.Menu wa 
  362.          Caption         =   "Tile Horizontally"
  363.          Index           =   1
  364.       End
  365.       Begin VB.Menu wa 
  366.          Caption         =   "Tile Vertically"
  367.          Index           =   2
  368.       End
  369.       Begin VB.Menu wa 
  370.          Caption         =   "Arrange Icons"
  371.          Index           =   3
  372.       End
  373.    End
  374.    Begin VB.Menu HelpMenu 
  375.       Caption         =   "&Help"
  376.       Begin VB.Menu About 
  377.          Caption         =   "&About"
  378.       End
  379.    End
  380. Attribute VB_Name = "VBMail"
  381. Attribute VB_Creatable = False
  382. Attribute VB_Exposed = False
  383. Private Sub About_Click()
  384.     MsgBox "Sample Mail Application", 0, "VB Mail"
  385. End Sub
  386. Private Sub Delete_Click()
  387. ' Delete a mail message.
  388.     ' View all selected messages that are deleted.
  389.     If TypeOf VBMail.ActiveForm Is MsgView Then
  390.         Call DeleteMessage
  391.     ElseIf TypeOf VBMail.ActiveForm Is MailLst Then
  392.         ' Delete multiple selection.
  393.         VBMail.MapiMess.MsgIndex = MailLst.MList.ListIndex
  394.         Call DeleteMessage
  395.     End If
  396. End Sub
  397. Private Sub DispTools_Click()
  398.     DispTools.Checked = Not DispTools.Checked
  399.     MailLst.Tools.Visible = DispTools.Checked
  400.     If MailLst.Tools.Visible Then
  401.         Factor = 1
  402.         ToolsSize% = -MailLst.Tools.Height
  403.     Else
  404.         Factor = -1
  405.         ToolsSize% = 0
  406.     End If
  407.     Select Case MailLst.WindowState
  408.         Case 0    ' Change the size of the form to reflect the addition or deletion of a toolbar.
  409.             MailLst.Height = MailLst.Height + (Factor * MailLst.Tools.Height)
  410.         Case 2    ' If maximized, adjust the size of the list box.
  411.             MailLst.MList.Height = ScaleHeight - 90 - MailLst.MList.Top + ToolsSize%
  412.     End Select
  413. End Sub
  414. Private Sub EditDelete_Click()
  415. ' Delete the items in the list.
  416. On Error GoTo Trap
  417.     If TypeOf VBMail.ActiveForm Is MailLst Then
  418.         Call Delete_Click
  419.     End If
  420.     Exit Sub
  421. Trap:
  422.     ' If an error occurs, there is probably no active form.
  423.     ' Exit the Sub procedure.
  424.     Exit Sub
  425. End Sub
  426. Private Sub Exit_Click()
  427.     ' Close the application and log off.
  428.     If MapiSess.SessionID <> 0 Then
  429.         Call logoff_Click
  430.     End If
  431.     End
  432. End Sub
  433. Private Sub FontPrt_Click()
  434.     ' Set the printer fonts.
  435.     On Error Resume Next
  436.     CMDialog1.Flags = 2
  437.     CMDialog1.FontName = Printer.FontName
  438.     CMDialog1.FontSize = Printer.FontSize
  439.     CMDialog1.FontBold = Printer.FontBold
  440.     CMDialog1.FontItalic = Printer.FontItalic
  441.     CMDialog1.ShowFont
  442.     If Err = 0 Then
  443.         Printer.FontName = CMDialog1.FontName
  444.         Printer.FontSize = CMDialog1.FontSize
  445.         Printer.FontBold = CMDialog1.FontBold
  446.         Printer.FontItalic = CMDialog1.FontItalic
  447.     End If
  448. End Sub
  449. Private Sub FontScreen_Click()
  450.     ' Set the screen fonts for the active control.
  451.     On Error Resume Next
  452.     CMDialog1.Flags = 1
  453.     CMDialog1.FontName = VBMail.ActiveForm.ActiveControl.FontName
  454.     CMDialog1.FontSize = VBMail.ActiveForm.ActiveControl.FontSize
  455.     CMDialog1.FontBold = VBMail.ActiveForm.ActiveControl.FontBold
  456.     CMDialog1.FontItalic = VBMail.ActiveForm.ActiveControl.FontItalic
  457.     CMDialog1.ShowFont
  458.     If Err = 0 Then
  459.         VBMail.ActiveForm.ActiveControl.FontName = CMDialog1.FontName
  460.         VBMail.ActiveForm.ActiveControl.FontSize = CMDialog1.FontSize
  461.         VBMail.ActiveForm.ActiveControl.FontBold = CMDialog1.FontBold
  462.         VBMail.ActiveForm.ActiveControl.FontItalic = CMDialog1.FontItalic
  463.     End If
  464. End Sub
  465. Private Sub logoff_Click()
  466.     ' Log off from the mail system.
  467.     Call LogOffUser
  468. End Sub
  469. Private Sub Logon_Click()
  470.     ' Log onto the mail system.
  471.     On Error Resume Next
  472.     MapiSess.Action = 1
  473.     If Err <> 0 Then
  474.         MsgBox "Logon Failure: " + Error$
  475.     Else
  476.         Screen.MousePointer = 11
  477.         MapiMess.SessionID = MapiSess.SessionID
  478.         ' Get the message count.
  479.         GetMessageCount
  480.         ' Load the mail list with envelope information.
  481.         Screen.MousePointer = 11
  482.         Call LoadList(MapiMess)
  483.         Screen.MousePointer = 0
  484.         ' Adjust the buttons as needed.
  485.         Logon.Enabled = False
  486.         Logoff.Enabled = True
  487.         VBMail.SendCtl(vbMessageCompose).Enabled = True
  488.         VBMail.SendCtl(vbMessageReplyAll).Enabled = True
  489.         VBMail.SendCtl(vbMessageReply).Enabled = True
  490.         VBMail.SendCtl(vbMessageForward).Enabled = True
  491.         VBMail.PrintMessage.Enabled = True
  492.         VBMail.DispTools.Enabled = True
  493.         VBMail.rMsgList.Enabled = True
  494.         VBMail.EditDelete.Enabled = True
  495.       End If
  496. End Sub
  497. Private Sub MailOpts_Click()
  498.     ' Display the Mail Options form.
  499.     OptionType = conOptionGeneral
  500.     MailOptFrm.Show 1
  501. End Sub
  502. Private Sub MDIForm_Load()
  503.     ' Ensure all the controls are sized as needed.
  504.     TimeLbl = Time$
  505.      SendWithMapi = True
  506.      Call Picture1_Resize
  507.      Call Picture2_Resize
  508.      VBMail.MsgCountLbl = "Off Line"
  509. End Sub
  510. Private Sub Next_Click()
  511.     ' View the next message in the list.
  512.     If MailLst.MList.ListIndex <> MailLst.MList.ListCount - 1 Then
  513.         MailLst.MList.ItemData(MailLst.MList.ListIndex) = False
  514.         MailLst.MList.ListIndex = MailLst.MList.ListIndex + 1
  515.     End If
  516.     Call ViewNextMsg
  517. End Sub
  518. Private Sub Picture1_Resize()
  519. Const TimeBoxStartOffset = 1200
  520. Const TimeBoxEndOffset = 60
  521. Const MsgBoxStartOffset = 60
  522. Const MsgBoxEndOffset = TimeBoxStartOffset + 90
  523.     ' Adjust the sizes of the lines and position the time label.
  524.     TimeLbl.Left = picture1.Width - TimeLbl.Width - 265
  525.     TopLine2(0).X2 = picture1.Width
  526.     TopLine2(1).X2 = picture1.Width
  527.     TimeBoxLine(0).X1 = picture1.Width - TimeBoxStartOffset
  528.     TimeBoxLine(0).X2 = picture1.Width - TimeBoxEndOffset
  529.     TimeBoxLine(1).X1 = picture1.Width - TimeBoxStartOffset
  530.     TimeBoxLine(1).X2 = picture1.Width - TimeBoxEndOffset
  531.     TimeBoxSide(0).X1 = picture1.Width - TimeBoxStartOffset
  532.     TimeBoxSide(0).X2 = picture1.Width - TimeBoxStartOffset
  533.     TimeBoxSide(1).X1 = picture1.Width - TimeBoxEndOffset
  534.     TimeBoxSide(1).X2 = picture1.Width - TimeBoxEndOffset
  535.     MsgBoxLine(0).X2 = picture1.Width - MsgBoxEndOffset
  536.     MsgBoxLine(1).X2 = picture1.Width - MsgBoxEndOffset
  537.     MsgBoxSide(1).X1 = picture1.Width - MsgBoxEndOffset
  538.     MsgBoxSide(1).X2 = picture1.Width - MsgBoxEndOffset
  539.     picture1.Refresh
  540. End Sub
  541. Private Sub Picture2_Resize()
  542.     ' Adjust the positions of the lines.
  543.     TopLine(0).X2 = Picture2.Width
  544.     TopLine(1).X2 = Picture2.Width
  545.     Picture2.Refresh
  546. End Sub
  547. Private Sub Previous_Click()
  548.     ' View the previous message in the list.
  549.     If MailLst.MList.ListIndex <> 0 Then
  550.         MailLst.MList.ItemData(MailLst.MList.ListIndex) = False
  551.         MailLst.MList.ListIndex = MailLst.MList.ListIndex - 1
  552.     End If
  553.     Call ViewNextMsg
  554. End Sub
  555. Private Sub PrintMessage_Click()
  556.     ' Print mail.
  557.     Call PrintMail
  558. End Sub
  559. Private Sub PrSetup_Click()
  560. ' Call the printer setup procedure in the common dialog control.
  561. On Error Resume Next
  562.     CMDialog1.Flags = &H40  ' Printer setup dialog box only.
  563.     CMDialog1.ShowPrinter
  564. End Sub
  565. Private Sub rMsgList_Click()
  566.         Screen.MousePointer = 11
  567.         GetMessageCount
  568.         Call LoadList(MapiMess)
  569.         Screen.MousePointer = 0
  570. End Sub
  571. Private Sub SendCtl_Click(Index As Integer)
  572. Dim NewMessage As New NewMsg
  573.     On Error Resume Next
  574.     ' Index = 6: Compose New Message
  575.     '       = 7: Reply
  576.     '       = 8: Reply All
  577.     '       = 9: Forward
  578.     ' Save the header information and current note text.
  579.     If Index > 6 Then
  580.         ' SVNote = GetHeader(VBMAIL.MapiMess) + VBMAIL.MapiMess.MsgNoteText
  581.         SVNote = VBMail.MapiMess.MsgNoteText
  582.         SVNote = GetHeader(VBMail.MapiMess) + SVNote
  583.     End If
  584.     VBMail.MapiMess.Action = Index
  585.     ' Set the new message text.
  586.     If Index > 6 Then
  587.         VBMail.MapiMess.MsgNoteText = SVNote
  588.     End If
  589.     If SendWithMapi Then
  590.         VBMail.MapiMess.Action = vbMessageSendDlg
  591.     Else
  592.         Call LoadMessage(-1, NewMessage)            ' Load message into VBMail NewMSG window.
  593.     End If
  594. End Sub
  595. Private Sub ShowAB_Click()
  596. On Error Resume Next
  597.     ' Show the address for the current message.
  598.     VBMail.MapiMess.Action = vbMessageShowAdBook
  599.     If Err Then
  600.         If Err <> 32001 Then        ' User chose Cancel.
  601.             MsgBox "Error: " + Error$ + " occurred trying to show the Address Book"
  602.         End If
  603.     Else
  604.         If TypeOf VBMail.ActiveForm Is NewMsg Then
  605.             Call UpdateRecips(VBMail.ActiveForm)
  606.         End If
  607.     End If
  608. End Sub
  609. Private Sub Timer1_Timer()
  610.     ' Update the time label.
  611.     TimeLbl = Time$
  612. End Sub
  613. Private Sub wa_Click(Index As Integer)
  614.     ' Arrange the windows as selected.
  615.     VBMail.Arrange Index
  616. End Sub
  617.