home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Visual Basic new SourceCode and Projects / Vb E-mail Applictation / VBMAIL.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2000-04-15  |  20.3 KB  |  625 lines

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