home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD52134262000.psc / frmMain.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2000-04-25  |  18.8 KB  |  565 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  3. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  4. Begin VB.MDIForm frmMain 
  5.    BackColor       =   &H8000000C&
  6.    Caption         =   "TCrypt"
  7.    ClientHeight    =   5655
  8.    ClientLeft      =   165
  9.    ClientTop       =   735
  10.    ClientWidth     =   7530
  11.    Icon            =   "frmMain.frx":0000
  12.    LinkTopic       =   "MDIForm1"
  13.    StartUpPosition =   3  'Windows Default
  14.    Begin MSComctlLib.ImageList imgDisabled 
  15.       Left            =   1800
  16.       Top             =   480
  17.       _ExtentX        =   1005
  18.       _ExtentY        =   1005
  19.       BackColor       =   -2147483643
  20.       ImageWidth      =   32
  21.       ImageHeight     =   32
  22.       MaskColor       =   12632256
  23.       _Version        =   393216
  24.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  25.          NumListImages   =   2
  26.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  27.             Picture         =   "frmMain.frx":0442
  28.             Key             =   ""
  29.          EndProperty
  30.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  31.             Picture         =   "frmMain.frx":1096
  32.             Key             =   ""
  33.          EndProperty
  34.       EndProperty
  35.    End
  36.    Begin MSComctlLib.ImageList imlToolbarIcons 
  37.       Left            =   2400
  38.       Top             =   480
  39.       _ExtentX        =   1005
  40.       _ExtentY        =   1005
  41.       BackColor       =   -2147483643
  42.       ImageWidth      =   16
  43.       ImageHeight     =   16
  44.       MaskColor       =   12632256
  45.       _Version        =   393216
  46.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  47.          NumListImages   =   7
  48.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  49.             Picture         =   "frmMain.frx":1CEA
  50.             Key             =   "New2"
  51.          EndProperty
  52.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  53.             Picture         =   "frmMain.frx":222C
  54.             Key             =   "Open"
  55.          EndProperty
  56.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  57.             Picture         =   "frmMain.frx":233E
  58.             Key             =   "Save"
  59.          EndProperty
  60.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  61.             Picture         =   "frmMain.frx":2450
  62.             Key             =   "Print"
  63.          EndProperty
  64.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  65.             Picture         =   "frmMain.frx":2562
  66.             Key             =   "Cut"
  67.          EndProperty
  68.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  69.             Picture         =   "frmMain.frx":2674
  70.             Key             =   "Copy"
  71.          EndProperty
  72.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  73.             Picture         =   "frmMain.frx":2786
  74.             Key             =   "Paste"
  75.          EndProperty
  76.       EndProperty
  77.    End
  78.    Begin MSComctlLib.ImageList ImgList 
  79.       Left            =   1200
  80.       Top             =   480
  81.       _ExtentX        =   1005
  82.       _ExtentY        =   1005
  83.       BackColor       =   -2147483643
  84.       ImageWidth      =   32
  85.       ImageHeight     =   32
  86.       MaskColor       =   12632256
  87.       _Version        =   393216
  88.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  89.          NumListImages   =   4
  90.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  91.             Picture         =   "frmMain.frx":2898
  92.             Key             =   ""
  93.          EndProperty
  94.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  95.             Picture         =   "frmMain.frx":34EC
  96.             Key             =   ""
  97.          EndProperty
  98.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  99.             Picture         =   "frmMain.frx":4140
  100.             Key             =   ""
  101.          EndProperty
  102.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  103.             Picture         =   "frmMain.frx":4D94
  104.             Key             =   ""
  105.          EndProperty
  106.       EndProperty
  107.    End
  108.    Begin MSComctlLib.Toolbar tbToolBar 
  109.       Align           =   1  'Align Top
  110.       Height          =   420
  111.       Left            =   0
  112.       TabIndex        =   1
  113.       Top             =   0
  114.       Width           =   7530
  115.       _ExtentX        =   13282
  116.       _ExtentY        =   741
  117.       ButtonWidth     =   609
  118.       ButtonHeight    =   582
  119.       Appearance      =   1
  120.       ImageList       =   "imlToolbarIcons"
  121.       _Version        =   393216
  122.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  123.          NumButtons      =   9
  124.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  125.             Key             =   "New"
  126.             Object.ToolTipText     =   "New"
  127.             ImageKey        =   "New2"
  128.          EndProperty
  129.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  130.             Key             =   "Open"
  131.             Object.ToolTipText     =   "Open"
  132.             ImageKey        =   "Open"
  133.          EndProperty
  134.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  135.             Key             =   "Save"
  136.             Object.ToolTipText     =   "Save"
  137.             ImageKey        =   "Save"
  138.          EndProperty
  139.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  140.             Style           =   3
  141.          EndProperty
  142.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  143.             Key             =   "Print"
  144.             Object.ToolTipText     =   "Print"
  145.             ImageKey        =   "Print"
  146.          EndProperty
  147.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  148.             Style           =   3
  149.          EndProperty
  150.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  151.             Key             =   "Cut"
  152.             Object.ToolTipText     =   "Cut"
  153.             ImageKey        =   "Cut"
  154.          EndProperty
  155.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  156.             Key             =   "Copy"
  157.             Object.ToolTipText     =   "Copy"
  158.             ImageKey        =   "Copy"
  159.          EndProperty
  160.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  161.             Key             =   "Paste"
  162.             Object.ToolTipText     =   "Paste"
  163.             ImageKey        =   "Paste"
  164.          EndProperty
  165.       EndProperty
  166.    End
  167.    Begin MSComctlLib.StatusBar sbStatusBar 
  168.       Align           =   2  'Align Bottom
  169.       Height          =   270
  170.       Left            =   0
  171.       TabIndex        =   0
  172.       Top             =   5385
  173.       Width           =   7530
  174.       _ExtentX        =   13282
  175.       _ExtentY        =   476
  176.       _Version        =   393216
  177.       BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
  178.          NumPanels       =   3
  179.          BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  180.             AutoSize        =   1
  181.             Object.Width           =   7646
  182.             Text            =   "Status"
  183.             TextSave        =   "Status"
  184.          EndProperty
  185.          BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  186.             Style           =   6
  187.             AutoSize        =   2
  188.             TextSave        =   "4/25/00"
  189.          EndProperty
  190.          BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  191.             Style           =   5
  192.             AutoSize        =   2
  193.             TextSave        =   "6:55 PM"
  194.          EndProperty
  195.       EndProperty
  196.    End
  197.    Begin MSComDlg.CommonDialog dlgCommonDialog 
  198.       Left            =   3000
  199.       Top             =   2280
  200.       _ExtentX        =   847
  201.       _ExtentY        =   847
  202.       _Version        =   393216
  203.    End
  204.    Begin MSComctlLib.Toolbar tbCrypt 
  205.       Align           =   1  'Align Top
  206.       Height          =   660
  207.       Left            =   0
  208.       TabIndex        =   2
  209.       Top             =   420
  210.       Width           =   7530
  211.       _ExtentX        =   13282
  212.       _ExtentY        =   1164
  213.       ButtonWidth     =   1032
  214.       ButtonHeight    =   1005
  215.       Appearance      =   1
  216.       ImageList       =   "ImgList"
  217.       DisabledImageList=   "imgDisabled"
  218.       _Version        =   393216
  219.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  220.          NumButtons      =   2
  221.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  222.             Key             =   "Encrypt"
  223.             Object.ToolTipText     =   "Encrypt"
  224.             ImageIndex      =   1
  225.          EndProperty
  226.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  227.             Key             =   "Decrypt"
  228.             Object.ToolTipText     =   "Decrypt"
  229.             ImageIndex      =   2
  230.          EndProperty
  231.       EndProperty
  232.    End
  233.    Begin VB.Menu mnuFile 
  234.       Caption         =   "&File"
  235.       Begin VB.Menu mnuFileNew 
  236.          Caption         =   "&New"
  237.          Shortcut        =   ^N
  238.       End
  239.       Begin VB.Menu mnuFileOpen 
  240.          Caption         =   "&Open..."
  241.          Shortcut        =   ^O
  242.       End
  243.       Begin VB.Menu mnuFileBar0 
  244.          Caption         =   "-"
  245.       End
  246.       Begin VB.Menu mnuFileSave 
  247.          Caption         =   "&Save"
  248.       End
  249.       Begin VB.Menu mnuFileSaveAs 
  250.          Caption         =   "Save &As..."
  251.       End
  252.       Begin VB.Menu mnuFileBar1 
  253.          Caption         =   "-"
  254.       End
  255.       Begin VB.Menu mnuFilePrint 
  256.          Caption         =   "&Print..."
  257.       End
  258.       Begin VB.Menu mnuFileBar2 
  259.          Caption         =   "-"
  260.       End
  261.       Begin VB.Menu mnuFileExit 
  262.          Caption         =   "E&xit"
  263.       End
  264.    End
  265.    Begin VB.Menu mnuEdit 
  266.       Caption         =   "&Edit"
  267.       Begin VB.Menu mnuEditCut 
  268.          Caption         =   "Cu&t"
  269.          Shortcut        =   ^X
  270.       End
  271.       Begin VB.Menu mnuEditCopy 
  272.          Caption         =   "&Copy"
  273.          Shortcut        =   ^C
  274.       End
  275.       Begin VB.Menu mnuEditPaste 
  276.          Caption         =   "&Paste"
  277.          Shortcut        =   +{INSERT}
  278.       End
  279.    End
  280.    Begin VB.Menu mnuView 
  281.       Caption         =   "&View"
  282.       Begin VB.Menu mnuViewToolbar 
  283.          Caption         =   "&Toolbar"
  284.          Checked         =   -1  'True
  285.       End
  286.       Begin VB.Menu mnuViewStatusBar 
  287.          Caption         =   "Status &Bar"
  288.          Checked         =   -1  'True
  289.       End
  290.       Begin VB.Menu mnuViewBar0 
  291.          Caption         =   "-"
  292.       End
  293.       Begin VB.Menu mnuViewRefresh 
  294.          Caption         =   "&Refresh"
  295.       End
  296.    End
  297.    Begin VB.Menu mnuTools 
  298.       Caption         =   "&Tools"
  299.       Begin VB.Menu mnuEncrypt 
  300.          Caption         =   "&Encrypt"
  301.       End
  302.       Begin VB.Menu mnuDecrypt 
  303.          Caption         =   "&Decrypt"
  304.       End
  305.    End
  306.    Begin VB.Menu mnuWindow 
  307.       Caption         =   "&Window"
  308.       WindowList      =   -1  'True
  309.       Begin VB.Menu mnuWindowNewWindow 
  310.          Caption         =   "&New Window"
  311.       End
  312.       Begin VB.Menu mnuWindowBar0 
  313.          Caption         =   "-"
  314.       End
  315.       Begin VB.Menu mnuWindowCascade 
  316.          Caption         =   "&Cascade"
  317.       End
  318.       Begin VB.Menu mnuWindowTileHorizontal 
  319.          Caption         =   "Tile &Horizontal"
  320.       End
  321.       Begin VB.Menu mnuWindowTileVertical 
  322.          Caption         =   "Tile &Vertical"
  323.       End
  324.       Begin VB.Menu mnuWindowArrangeIcons 
  325.          Caption         =   "&Arrange Icons"
  326.       End
  327.    End
  328.    Begin VB.Menu mnuHelp 
  329.       Caption         =   "&Help"
  330.       Begin VB.Menu mnuHelpmnuSupport 
  331.          Caption         =   "&Support"
  332.       End
  333.       Begin VB.Menu mnuHelpBar0 
  334.          Caption         =   "-"
  335.       End
  336.       Begin VB.Menu mnuHelpAbout 
  337.          Caption         =   "&About "
  338.       End
  339.    End
  340. Attribute VB_Name = "frmMain"
  341. Attribute VB_GlobalNameSpace = False
  342. Attribute VB_Creatable = False
  343. Attribute VB_PredeclaredId = True
  344. Attribute VB_Exposed = False
  345. Private Sub MDIForm_Load()
  346.     Me.Left = GetSetting(App.Title, "Settings", "MainLeft", 1000)
  347.     Me.Top = GetSetting(App.Title, "Settings", "MainTop", 1000)
  348.     Me.Width = GetSetting(App.Title, "Settings", "MainWidth", 6500)
  349.     Me.Height = GetSetting(App.Title, "Settings", "MainHeight", 6500)
  350.     LoadNewDoc
  351.     fMainForm.tbCrypt.Buttons(1).Enabled = False
  352.     fMainForm.tbCrypt.Buttons(2).Enabled = False
  353.     fMainForm.mnuEncrypt.Enabled = False
  354.     fMainForm.mnuDecrypt.Enabled = False
  355. End Sub
  356. Private Sub LoadNewDoc()
  357.     Static lDocumentCount As Long
  358.     Dim frmD As frmDocument
  359.     lDocumentCount = lDocumentCount + 1
  360.     Set frmD = New frmDocument
  361.     frmD.Caption = "Document " & lDocumentCount
  362.     frmD.Show
  363. End Sub
  364. Private Sub MDIForm_Unload(Cancel As Integer)
  365.     If Me.WindowState <> vbMinimized Then
  366.         SaveSetting App.Title, "Settings", "MainLeft", Me.Left
  367.         SaveSetting App.Title, "Settings", "MainTop", Me.Top
  368.         SaveSetting App.Title, "Settings", "MainWidth", Me.Width
  369.         SaveSetting App.Title, "Settings", "MainHeight", Me.Height
  370.     End If
  371. End Sub
  372. Private Sub mnuDecrypt_Click()
  373.     Decrypt ActiveForm.rtfText.Text, ActiveForm.rtfText
  374. End Sub
  375. Private Sub mnuEncrypt_Click()
  376.     Encrypt ActiveForm.rtfText.Text, ActiveForm.rtfText
  377. End Sub
  378. Private Sub tbToolBar_ButtonClick(ByVal Button As MSComctlLib.Button)
  379.     On Error Resume Next
  380.     Select Case Button.Key
  381.         Case "New"
  382.             LoadNewDoc
  383.         Case "Open"
  384.             mnuFileOpen_Click
  385.         Case "Save"
  386.             mnuFileSave_Click
  387.         Case "Print"
  388.             mnuFilePrint_Click
  389.         Case "Cut"
  390.             mnuEditCut_Click
  391.         Case "Copy"
  392.             mnuEditCopy_Click
  393.         Case "Paste"
  394.             mnuEditPaste_Click
  395.     End Select
  396. End Sub
  397. Private Sub mnuHelpAbout_Click()
  398.     frmAbout.Show vbModal, Me
  399. End Sub
  400. Private Sub mnuHelpmnuSupport_Click()
  401.     MsgBox "Email me: adz@bluehome.net"
  402. End Sub
  403. Private Sub mnuWindowArrangeIcons_Click()
  404.     Me.Arrange vbArrangeIcons
  405. End Sub
  406. Private Sub mnuWindowTileVertical_Click()
  407.     Me.Arrange vbTileVertical
  408. End Sub
  409. Private Sub mnuWindowTileHorizontal_Click()
  410.     Me.Arrange vbTileHorizontal
  411. End Sub
  412. Private Sub mnuWindowCascade_Click()
  413.     Me.Arrange vbCascade
  414. End Sub
  415. Private Sub mnuWindowNewWindow_Click()
  416.     LoadNewDoc
  417. End Sub
  418. Private Sub mnuViewRefresh_Click()
  419.     ActiveForm.rtfText.Refresh
  420. End Sub
  421. Private Sub mnuViewStatusBar_Click()
  422.     mnuViewStatusBar.Checked = Not mnuViewStatusBar.Checked
  423.     sbStatusBar.Visible = mnuViewStatusBar.Checked
  424. End Sub
  425. Private Sub mnuViewToolbar_Click()
  426.     mnuViewToolbar.Checked = Not mnuViewToolbar.Checked
  427.     tbToolBar.Visible = mnuViewToolbar.Checked
  428. End Sub
  429. Private Sub mnuEditPaste_Click()
  430.     On Error Resume Next
  431.     ActiveForm.rtfText.SelRTF = Clipboard.GetText
  432. End Sub
  433. Private Sub mnuEditCopy_Click()
  434.     On Error Resume Next
  435.     Clipboard.SetText ActiveForm.rtfText.SelRTF
  436. End Sub
  437. Private Sub mnuEditCut_Click()
  438.     On Error Resume Next
  439.     Clipboard.SetText ActiveForm.rtfText.SelRTF
  440.     ActiveForm.rtfText.SelText = vbNullString
  441. End Sub
  442. Private Sub mnuFileExit_Click()
  443.     'unload the form
  444.     Unload Me
  445. End Sub
  446. Private Sub mnuFilePrint_Click()
  447.     On Error Resume Next
  448.     If ActiveForm Is Nothing Then Exit Sub
  449.     With dlgCommonDialog
  450.         .DialogTitle = "Print"
  451.         .CancelError = True
  452.         .Flags = cdlPDReturnDC + cdlPDNoPageNums
  453.         If ActiveForm.rtfText.SelLength = 0 Then
  454.             .Flags = .Flags + cdlPDAllPages
  455.         Else
  456.             .Flags = .Flags + cdlPDSelection
  457.         End If
  458.         .ShowPrinter
  459.         If Err <> MSComDlg.cdlCancel Then
  460.             ActiveForm.rtfText.SelPrint .hDC
  461.         End If
  462.     End With
  463. End Sub
  464. Private Sub mnuFileSaveAs_Click()
  465.     On Error Resume Next
  466.     Dim sFile As String
  467.     Dim Num As Byte
  468.     Dim sText As String
  469.     If ActiveForm Is Nothing Then Exit Sub
  470.     With dlgCommonDialog
  471.         .DialogTitle = "Save As"
  472.         .CancelError = True
  473.         'ToDo: set the flags and attributes of the common dialog control
  474.         .Filter = "Text Files (*.TXT*)|*.TXT*"
  475.         .ShowSave
  476.         If Len(.FileName) = 0 Then
  477.             Exit Sub
  478.         End If
  479.         sFile = .FileName
  480.     End With
  481.     If LCase(Right(sFile, 4)) <> ".txt" Then
  482.         sFile = sFile & ".txt"
  483.     End If
  484.     sText = ActiveForm.rtfText.Text
  485.     Num = FreeFile
  486.     Kill sFile
  487.     Open sFile For Binary As Num
  488.     Put Num, , sText
  489.     Close Num
  490.     ActiveForm.Caption = sFile
  491. End Sub
  492. Private Sub mnuFileSave_Click()
  493.     On Error Resume Next
  494.     Dim sFile As String
  495.     Dim sText As String
  496.     Dim Num As Byte
  497.     If Left$(ActiveForm.Caption, 8) = "Document" Then
  498.         With dlgCommonDialog
  499.             .DialogTitle = "Save"
  500.             .CancelError = True
  501.             'ToDo: set the flags and attributes of the common dialog control
  502.             .Filter = "Text Files (*.TXT*)|*.TXT*"
  503.             .ShowSave
  504.             If Len(.FileName) = 0 Then
  505.                 Exit Sub
  506.             End If
  507.             sFile = .FileName
  508.         End With
  509.         If LCase(Right(sFile, 4)) <> ".txt" Then
  510.             sFile = sFile & ".txt"
  511.         End If
  512.         sText = ActiveForm.rtfText.Text
  513.         Num = FreeFile
  514.         Kill sFile
  515.         Open sFile For Binary As Num
  516.         Put Num, , sText
  517.         Close Num
  518.         ActiveForm.Caption = sFile
  519.     Else
  520.         sFile = ActiveForm.Caption
  521.         sText = ActiveForm.rtfText.Text
  522.         Num = FreeFile
  523.         Kill sFile
  524.         Open sFile For Binary As Num
  525.         Put Num, , sText
  526.         Close Num
  527.         ActiveForm.Caption = sFile
  528.     End If
  529. End Sub
  530. Private Sub mnuFileOpen_Click()
  531.     Dim sFile As String
  532.     Dim sText As String
  533.     Dim Num As Byte
  534.     If ActiveForm Is Nothing Then LoadNewDoc
  535.     With dlgCommonDialog
  536.         .DialogTitle = "Open"
  537.         .CancelError = True
  538.         'ToDo: set the flags and attributes of the common dialog control
  539.         .Filter = "Plain Text Files (*.TXT*)|*.TXT*"
  540.         .ShowOpen
  541.         If Len(.FileName) = 0 Then
  542.             Exit Sub
  543.         End If
  544.         sFile = .FileName
  545.     End With
  546.     Num = FreeFile
  547.     Open sFile For Binary As Num
  548.     sText = Space(LOF(Num))
  549.     Get Num, , sText
  550.     Close Num
  551.     ActiveForm.rtfText.Text = sText
  552.     ActiveForm.Caption = sFile
  553. End Sub
  554. Private Sub mnuFileNew_Click()
  555.     LoadNewDoc
  556. End Sub
  557. Private Sub tbCrypt_ButtonClick(ByVal Button As MSComctlLib.Button)
  558.     Select Case Button.Key
  559.         Case "Encrypt"
  560.         Encrypt ActiveForm.rtfText.Text, ActiveForm.rtfText
  561.         Case "Decrypt"
  562.         Decrypt ActiveForm.rtfText.Text, ActiveForm.rtfText
  563.     End Select
  564. End Sub
  565.