home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD138341162001.psc / SplitFile.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-01-16  |  30.1 KB  |  796 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.Form frmsplit 
  5.    BorderStyle     =   1  'Fixed Single
  6.    Caption         =   "CuteSplit 2.0"
  7.    ClientHeight    =   5685
  8.    ClientLeft      =   45
  9.    ClientTop       =   330
  10.    ClientWidth     =   8205
  11.    KeyPreview      =   -1  'True
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    ScaleHeight     =   5685
  15.    ScaleWidth      =   8205
  16.    StartUpPosition =   3  'Windows Default
  17.    Begin MSComctlLib.ImageList ImageList2 
  18.       Left            =   600
  19.       Top             =   4080
  20.       _ExtentX        =   1005
  21.       _ExtentY        =   1005
  22.       BackColor       =   -2147483643
  23.       ImageWidth      =   16
  24.       ImageHeight     =   16
  25.       MaskColor       =   12632256
  26.       _Version        =   393216
  27.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  28.          NumListImages   =   1
  29.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  30.             Picture         =   "SplitFile.frx":0000
  31.             Key             =   "FILE"
  32.          EndProperty
  33.       EndProperty
  34.    End
  35.    Begin MSComctlLib.ImageList ImageList1 
  36.       Left            =   720
  37.       Top             =   3360
  38.       _ExtentX        =   1005
  39.       _ExtentY        =   1005
  40.       BackColor       =   -2147483643
  41.       ImageWidth      =   32
  42.       ImageHeight     =   32
  43.       MaskColor       =   12632256
  44.       _Version        =   393216
  45.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  46.          NumListImages   =   9
  47.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  48.             Picture         =   "SplitFile.frx":031A
  49.             Key             =   "EXIT"
  50.          EndProperty
  51.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  52.             Picture         =   "SplitFile.frx":0424
  53.             Key             =   "ABOUT"
  54.          EndProperty
  55.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  56.             Picture         =   "SplitFile.frx":0876
  57.             Key             =   "SPLITF"
  58.          EndProperty
  59.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  60.             Picture         =   "SplitFile.frx":14C8
  61.             Key             =   "JOIN"
  62.          EndProperty
  63.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  64.             Picture         =   "SplitFile.frx":211A
  65.             Key             =   ""
  66.          EndProperty
  67.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  68.             Picture         =   "SplitFile.frx":2D6C
  69.             Key             =   ""
  70.          EndProperty
  71.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  72.             Picture         =   "SplitFile.frx":39BE
  73.             Key             =   ""
  74.          EndProperty
  75.          BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  76.             Picture         =   "SplitFile.frx":4610
  77.             Key             =   "SPLIT"
  78.          EndProperty
  79.          BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  80.             Picture         =   "SplitFile.frx":5262
  81.             Key             =   "TOOLS"
  82.          EndProperty
  83.       EndProperty
  84.    End
  85.    Begin MSComctlLib.ListView ListView1 
  86.       Height          =   5653
  87.       Left            =   0
  88.       TabIndex        =   0
  89.       Top             =   0
  90.       Width           =   1575
  91.       _ExtentX        =   2778
  92.       _ExtentY        =   9975
  93.       LabelEdit       =   1
  94.       LabelWrap       =   -1  'True
  95.       HideSelection   =   -1  'True
  96.       OLEDragMode     =   1
  97.       HotTracking     =   -1  'True
  98.       HoverSelection  =   -1  'True
  99.       _Version        =   393217
  100.       Icons           =   "ImageList1"
  101.       ForeColor       =   -2147483640
  102.       BackColor       =   -2147483643
  103.       BorderStyle     =   1
  104.       Appearance      =   1
  105.       OLEDragMode     =   1
  106.       NumItems        =   0
  107.    End
  108.    Begin MSComDlg.CommonDialog CmDlg 
  109.       Left            =   5520
  110.       Top             =   2520
  111.       _ExtentX        =   847
  112.       _ExtentY        =   847
  113.       _Version        =   393216
  114.    End
  115.    Begin VB.PictureBox Picture1 
  116.       BackColor       =   &H00C0C0C0&
  117.       Height          =   5633
  118.       Index           =   0
  119.       Left            =   1560
  120.       ScaleHeight     =   5580
  121.       ScaleWidth      =   6525
  122.       TabIndex        =   1
  123.       Top             =   0
  124.       Width           =   6585
  125.       Begin MSComctlLib.ProgressBar ProgressBar1 
  126.          Height          =   255
  127.          Left            =   -120
  128.          TabIndex        =   17
  129.          Top             =   360
  130.          Visible         =   0   'False
  131.          Width           =   6795
  132.          _ExtentX        =   11986
  133.          _ExtentY        =   450
  134.          _Version        =   393216
  135.          BorderStyle     =   1
  136.          Appearance      =   1
  137.       End
  138.       Begin MSComctlLib.ListView ListView2 
  139.          Height          =   2715
  140.          Left            =   0
  141.          TabIndex        =   16
  142.          Top             =   2880
  143.          Width           =   6525
  144.          _ExtentX        =   11509
  145.          _ExtentY        =   4789
  146.          View            =   3
  147.          LabelEdit       =   1
  148.          LabelWrap       =   -1  'True
  149.          HideSelection   =   -1  'True
  150.          OLEDragMode     =   1
  151.          _Version        =   393217
  152.          Icons           =   "ImageList2"
  153.          SmallIcons      =   "ImageList2"
  154.          ForeColor       =   -2147483640
  155.          BackColor       =   16777215
  156.          BorderStyle     =   1
  157.          Appearance      =   0
  158.          OLEDragMode     =   1
  159.          NumItems        =   2
  160.          BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
  161.             Key             =   "Name"
  162.             Text            =   "Splitted Files"
  163.             Object.Width           =   8467
  164.          EndProperty
  165.          BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
  166.             Alignment       =   1
  167.             SubItemIndex    =   1
  168.             Key             =   "Size"
  169.             Text            =   "Size"
  170.             Object.Width           =   2682
  171.          EndProperty
  172.       End
  173.       Begin VB.Frame FraAbout 
  174.          BorderStyle     =   0  'None
  175.          Height          =   5415
  176.          Left            =   0
  177.          TabIndex        =   30
  178.          Top             =   360
  179.          Width           =   6495
  180.          Begin VB.PictureBox Picture2 
  181.             BorderStyle     =   0  'None
  182.             Height          =   1095
  183.             Left            =   120
  184.             Picture         =   "SplitFile.frx":5EB4
  185.             ScaleHeight     =   1095
  186.             ScaleWidth      =   1215
  187.             TabIndex        =   31
  188.             Top             =   360
  189.             Width           =   1215
  190.          End
  191.          Begin VB.Label Label8 
  192.             Caption         =   $"SplitFile.frx":9AA2
  193.             Height          =   855
  194.             Left            =   120
  195.             TabIndex        =   34
  196.             Top             =   4200
  197.             Width           =   5415
  198.          End
  199.          Begin VB.Label Label5 
  200.             Caption         =   "Copyright (c) 2001 R. Habibi."
  201.             Height          =   255
  202.             Left            =   3360
  203.             TabIndex        =   33
  204.             Top             =   840
  205.             Width           =   2295
  206.          End
  207.          Begin VB.Label Label4 
  208.             Caption         =   "CuteSplit 2.0"
  209.             BeginProperty Font 
  210.                Name            =   "Tahoma"
  211.                Size            =   24
  212.                Charset         =   0
  213.                Weight          =   400
  214.                Underline       =   0   'False
  215.                Italic          =   0   'False
  216.                Strikethrough   =   0   'False
  217.             EndProperty
  218.             Height          =   615
  219.             Left            =   3240
  220.             TabIndex        =   32
  221.             Top             =   240
  222.             Width           =   2775
  223.          End
  224.       End
  225.       Begin VB.Frame FraOptions 
  226.          BorderStyle     =   0  'None
  227.          Height          =   2175
  228.          Left            =   0
  229.          TabIndex        =   25
  230.          Top             =   480
  231.          Width           =   6495
  232.          Begin VB.CheckBox chkDelSplitConfirm 
  233.             Caption         =   "Confirm when deleting all splitted files"
  234.             Height          =   255
  235.             Left            =   360
  236.             TabIndex        =   29
  237.             Top             =   1800
  238.             Width           =   3495
  239.          End
  240.          Begin VB.CheckBox chkDelSplit 
  241.             Caption         =   "Delete splitted files after successful join"
  242.             Height          =   255
  243.             Left            =   360
  244.             TabIndex        =   28
  245.             Top             =   1080
  246.             Width           =   3615
  247.          End
  248.          Begin VB.CheckBox chkDelSourceConfirm 
  249.             Caption         =   "Confirm when deleting the source file"
  250.             Height          =   255
  251.             Left            =   360
  252.             TabIndex        =   27
  253.             Top             =   1440
  254.             Width           =   3975
  255.          End
  256.          Begin VB.CheckBox chkDelSource 
  257.             Caption         =   "Delete source file after it is splitted successfully"
  258.             Height          =   255
  259.             Left            =   360
  260.             TabIndex        =   26
  261.             Top             =   720
  262.             Width           =   5175
  263.          End
  264.       End
  265.       Begin VB.Frame FraSplit 
  266.          BackColor       =   &H00C0C0C0&
  267.          BorderStyle     =   0  'None
  268.          Caption         =   "Frame1"
  269.          Height          =   2055
  270.          Left            =   120
  271.          TabIndex        =   3
  272.          Top             =   600
  273.          Width           =   6255
  274.          Begin VB.CommandButton cmdSplitDest 
  275.             BackColor       =   &H00C0C0C0&
  276.             Caption         =   "..."
  277.             Height          =   300
  278.             Left            =   4680
  279.             Style           =   1  'Graphical
  280.             TabIndex        =   21
  281.             Top             =   1680
  282.             Width           =   300
  283.          End
  284.          Begin VB.TextBox txtSplitDest 
  285.             Height          =   285
  286.             Left            =   120
  287.             Locked          =   -1  'True
  288.             TabIndex        =   18
  289.             Top             =   1680
  290.             Width           =   4575
  291.          End
  292.          Begin VB.CommandButton cmdSplit 
  293.             BackColor       =   &H00C0C0C0&
  294.             Caption         =   "&Split"
  295.             Height          =   375
  296.             Left            =   5280
  297.             Style           =   1  'Graphical
  298.             TabIndex        =   8
  299.             Top             =   480
  300.             Width           =   975
  301.          End
  302.          Begin VB.ComboBox CboSize 
  303.             Height          =   315
  304.             ItemData        =   "SplitFile.frx":9BC1
  305.             Left            =   2520
  306.             List            =   "SplitFile.frx":9BD4
  307.             Style           =   2  'Dropdown List
  308.             TabIndex        =   7
  309.             Top             =   1080
  310.             Width           =   2415
  311.          End
  312.          Begin VB.TextBox Text2 
  313.             Alignment       =   1  'Right Justify
  314.             BackColor       =   &H00FFFFFF&
  315.             Height          =   315
  316.             Left            =   120
  317.             TabIndex        =   6
  318.             Top             =   1080
  319.             Width           =   2295
  320.          End
  321.          Begin VB.TextBox txtsplit 
  322.             Height          =   285
  323.             Left            =   120
  324.             Locked          =   -1  'True
  325.             TabIndex        =   5
  326.             Top             =   480
  327.             Width           =   4575
  328.          End
  329.          Begin VB.CommandButton cmdBrowse 
  330.             BackColor       =   &H00C0C0C0&
  331.             Caption         =   "..."
  332.             Height          =   300
  333.             Left            =   4680
  334.             Style           =   1  'Graphical
  335.             TabIndex        =   4
  336.             Top             =   480
  337.             Width           =   300
  338.          End
  339.          Begin VB.Label Label7 
  340.             BackStyle       =   0  'Transparent
  341.             Caption         =   "Destination:"
  342.             Height          =   255
  343.             Left            =   120
  344.             TabIndex        =   22
  345.             Top             =   1440
  346.             Width           =   1215
  347.          End
  348.          Begin VB.Label Label2 
  349.             BackStyle       =   0  'Transparent
  350.             Caption         =   "Splitted File Size:"
  351.             Height          =   255
  352.             Left            =   120
  353.             TabIndex        =   10
  354.             Top             =   840
  355.             Width           =   1695
  356.          End
  357.          Begin VB.Label Label1 
  358.             BackStyle       =   0  'Transparent
  359.             Caption         =   "File to be splitted:"
  360.             ForeColor       =   &H00000000&
  361.             Height          =   255
  362.             Left            =   120
  363.             TabIndex        =   9
  364.             Top             =   240
  365.             Width           =   1335
  366.          End
  367.       End
  368.       Begin VB.Frame FraJoin 
  369.          BackColor       =   &H00C0C0C0&
  370.          BorderStyle     =   0  'None
  371.          Caption         =   "Frame1"
  372.          Height          =   2055
  373.          Left            =   0
  374.          TabIndex        =   11
  375.          Top             =   600
  376.          Width           =   6375
  377.          Begin VB.CommandButton cmdJoinDest 
  378.             BackColor       =   &H00C0C0C0&
  379.             Caption         =   "..."
  380.             Height          =   300
  381.             Left            =   4800
  382.             Style           =   1  'Graphical
  383.             TabIndex        =   20
  384.             Top             =   1080
  385.             Width           =   300
  386.          End
  387.          Begin VB.TextBox txtJoinDest 
  388.             Height          =   285
  389.             Left            =   240
  390.             Locked          =   -1  'True
  391.             TabIndex        =   19
  392.             Top             =   1080
  393.             Width           =   4575
  394.          End
  395.          Begin VB.CommandButton cmdJoin 
  396.             BackColor       =   &H00C0C0C0&
  397.             Caption         =   "&Join"
  398.             Height          =   375
  399.             Left            =   5400
  400.             Style           =   1  'Graphical
  401.             TabIndex        =   15
  402.             Top             =   480
  403.             Width           =   975
  404.          End
  405.          Begin VB.CommandButton cmdBrowseJoin 
  406.             BackColor       =   &H00C0C0C0&
  407.             Caption         =   "..."
  408.             Height          =   300
  409.             Left            =   4800
  410.             Style           =   1  'Graphical
  411.             TabIndex        =   13
  412.             Top             =   480
  413.             Width           =   300
  414.          End
  415.          Begin VB.TextBox txtJoin 
  416.             Height          =   285
  417.             Left            =   240
  418.             TabIndex        =   12
  419.             Top             =   480
  420.             Width           =   4575
  421.          End
  422.          Begin VB.Label Label6 
  423.             BackStyle       =   0  'Transparent
  424.             Caption         =   "Destination:"
  425.             Height          =   255
  426.             Left            =   240
  427.             TabIndex        =   23
  428.             Top             =   840
  429.             Width           =   1095
  430.          End
  431.          Begin VB.Label Label3 
  432.             BackStyle       =   0  'Transparent
  433.             Caption         =   "Locate the first splitted file:"
  434.             Height          =   255
  435.             Left            =   240
  436.             TabIndex        =   14
  437.             Top             =   240
  438.             Width           =   2535
  439.          End
  440.       End
  441.       Begin VB.Label lblcaption 
  442.          BackColor       =   &H00808080&
  443.          BeginProperty Font 
  444.             Name            =   "Verdana"
  445.             Size            =   14.25
  446.             Charset         =   0
  447.             Weight          =   700
  448.             Underline       =   0   'False
  449.             Italic          =   0   'False
  450.             Strikethrough   =   0   'False
  451.          EndProperty
  452.          ForeColor       =   &H00C0C0C0&
  453.          Height          =   375
  454.          Left            =   0
  455.          TabIndex        =   2
  456.          Top             =   0
  457.          Width           =   6615
  458.       End
  459.       Begin VB.Label lblstatus 
  460.          BackStyle       =   0  'Transparent
  461.          BeginProperty Font 
  462.             Name            =   "Verdana"
  463.             Size            =   6.75
  464.             Charset         =   0
  465.             Weight          =   400
  466.             Underline       =   0   'False
  467.             Italic          =   0   'False
  468.             Strikethrough   =   0   'False
  469.          EndProperty
  470.          ForeColor       =   &H00808080&
  471.          Height          =   180
  472.          Left            =   120
  473.          TabIndex        =   24
  474.          Top             =   2640
  475.          Width           =   6375
  476.       End
  477.    End
  478. Attribute VB_Name = "frmsplit"
  479. Attribute VB_GlobalNameSpace = False
  480. Attribute VB_Creatable = False
  481. Attribute VB_PredeclaredId = True
  482. Attribute VB_Exposed = False
  483. '--------------------------------------------------------------------
  484. 'Autor         : Rohullah Habibi
  485. 'Date          : Jan 12, 2001
  486. '--------------------------------------------------------------------
  487. 'Application   : Split/Join Files
  488. 'Description   : Split/join any type of file
  489. '                pure VB code no Dll or Activex and very fast.
  490. 'Dependencies  : SplitFile Class and JoinFile Class
  491. Private Sub cmdBrowse_Click()
  492.    'get the file to be splitted
  493.    txtsplit.Text = LCase(LocateFile())
  494.    'set destination path same as source file if it is blank
  495.    If txtSplitDest.Text = "" Then txtSplitDest.Text = GetFilePath(txtsplit.Text)
  496.    'go to size text box
  497.    Text2.SetFocus
  498. End Sub
  499. Private Sub cmdBrowseJoin_Click()
  500.     Dim strFile As String
  501.     'get the first splitted file to create the joined file
  502.     strFile = LCase(LocateFile())
  503.     If strFile <> "" Then
  504.         
  505.         'instantiate a new instance of the join class
  506.         Dim JoinIt As New JoinFile
  507.         
  508.         'set some properties of the join object
  509.         
  510.         JoinIt.JoinThisFile = strFile
  511.         'if you want to display the list of splitted files
  512.         'set this property to a listview object
  513.         Set JoinIt.FilesListview = ListView2
  514.         
  515.         'locate the first and all splitted files
  516.         JoinIt.LocateSplitedFiles
  517.         
  518.         'if the ErrNumber property <> 0 then an error occured in the
  519.         'Join class and the ErrMeesage property has the last error message.
  520.         If JoinIt.ErrNumber <> 0 Then
  521.             MsgBox JoinIt.ErrMessage, vbCritical + vbOKOnly
  522.             cmdJoin.Enabled = False
  523.             txtJoin.Text = ""
  524.             txtJoinDest.Text = ""
  525.         Else
  526.             'if no error so far, then the user have all splitted files
  527.             cmdJoin.Enabled = True
  528.             txtJoin.Text = strFile
  529.             If txtJoinDest.Text = "" And Left(strFile, 2) <> "a:" Then txtJoinDest.Text = GetFilePath(txtJoin.Text)
  530.         End If
  531.         'release the instance
  532.         Set JoinIt = Nothing
  533.     End If
  534. End Sub
  535. Private Sub cmdJoin_Click()
  536.     'check if the the user selected a splitted file to be joined
  537.     If txtJoin.Text = "" Then
  538.         MsgBox "Please locate the first splitted file!", vbCritical + vbOKOnly
  539.         Exit Sub
  540.     End If
  541.     'check if the the user selected the destination
  542.     If txtJoinDest.Text = "" Then
  543.         MsgBox "Please specify destination for the joined file!", vbCritical + vbOKOnly
  544.         Exit Sub
  545.     End If
  546.         
  547.         'create an instance of the join class and set some properties
  548.         Dim JoinIt As New JoinFile
  549.         JoinIt.JoinThisFile = txtJoin.Text
  550.         
  551.         JoinIt.DestinationPath = txtJoinDest.Text
  552.         
  553.         'if you want to show the process in the ProgressBar, then set this
  554.         'property to a ProgressBar control
  555.         Set JoinIt.ProcessBar = ProgressBar1
  556.         'if you want to show the process in the label control, then
  557.         'set this property to a label control
  558.         Set JoinIt.StatusLabel = lblstatus
  559.         'if you want to show all splitted file in a listview, then set this
  560.         'property to a ListView control
  561.         Set JoinIt.FilesListview = ListView2
  562.         
  563.         'once again check to make sure the user has all the right splitted files
  564.         JoinIt.LocateSplitedFiles
  565.         
  566.         'if no error in the Join object then proceed with
  567.         'joining all splitted files
  568.         If JoinIt.ErrNumber <> 0 Then
  569.             MsgBox JoinIt.ErrMessage
  570.         Else
  571.             
  572.             Screen.MousePointer = vbHourglass
  573.             JoinIt.JoinFiles
  574.             Screen.MousePointer = vbDefault
  575.         
  576.             If JoinIt.ErrNumber <> 0 Then
  577.                MsgBox "Error: " & JoinIt.ErrNumber & " : " & _
  578.                JoinIt.ErrMessage, vbCritical + vbOKOnly
  579.             Else
  580.               MsgBox "The file: " & JoinIt.DestinationPath & JoinIt.FileName & Chr(13) & _
  581.               " has been created from all splitted files successfully.", vbInformation + vbOKOnly
  582.             
  583.                 'if the user wants to delete all splitted files after join, then
  584.                 'get red of them.
  585.                 'Note: to set this option click on "Option" icon.
  586.                 If chkDelSplit.Value Then
  587.                     JoinIt.ConfirmDelete = chkDelSplitConfirm.Value
  588.                     JoinIt.DeleteSplittedFiles
  589.                 End If
  590.             End If
  591.         End If
  592.         'we are done, release the instance
  593.         Set JoinIt = Nothing
  594. End Sub
  595. Private Sub cmdJoinDest_Click()
  596.     'pop the destination folder selection form and let
  597.     'the user pick the destination where he/she can save the joined file
  598.     frmFolders.Show vbModal, Me
  599.     If gDestination <> "" Then
  600.         txtJoinDest.Text = LCase(IIf(Right(gDestination, 1) <> "\", gDestination & "\", gDestination))
  601.     End If
  602. End Sub
  603. Private Sub cmdSplit_Click()
  604.     Dim strSplitSize As String
  605.     'check if the the user selected a file to be splitted
  606.     If txtsplit.Text = "" Then
  607.         MsgBox "Please select a file to be splitted.", vbCritical + vbOKOnly
  608.         Exit Sub
  609.     End If
  610.     'check if the the user selected the destination for splitted files
  611.     If txtSplitDest.Text = "" Then
  612.         MsgBox "Please specify destination for the splitted files!", vbCritical + vbOKOnly
  613.         Exit Sub
  614.     End If
  615.    'check if the the user enetred a size for the file to splitted into.
  616.    If Text2.Text = "" Then
  617.         MsgBox "Invalid splitted file size value!", vbCritical + vbOKOnly
  618.         Text2.SetFocus
  619.         Exit Sub
  620.     End If
  621.     Select Case CboSize.ListIndex
  622.         Case 0
  623.             strSplitSize = "BT"
  624.         Case 1
  625.             strSplitSize = "KB"
  626.         Case 2
  627.             strSplitSize = "MB"
  628.         Case 3
  629.             strSplitSize = "GB"
  630.         Case 4
  631.             strSplitSize = "LN"
  632.     End Select
  633.     'ok, the user entered all required inputs, so lets create the
  634.     'Split object and set some properties
  635.     Dim SplitIt As New SplitFile
  636.     SplitIt.SplitThisFile = txtsplit.Text
  637.     SplitIt.SplittedFileSize = Val(Text2.Text)
  638.     SplitIt.DestinationPath = txtSplitDest.Text
  639.     SplitIt.SplittedFileBasedOn = strSplitSize
  640.     'if you want to show the process in the ProgressBar, then set this
  641.     'property to a ProgressBar control
  642.     Set SplitIt.ProcessBar = ProgressBar1
  643.     'if you want to show the process in the Label control, then set this
  644.     'property to a Label control
  645.     Set SplitIt.StatusLabel = lblstatus
  646.     'if you want to show the list of splitted files in the ListView control, then
  647.     'set this property to a ListView control
  648.     Set SplitIt.FilesListview = ListView2
  649.     'Ok, we are all set lets get the job done.
  650.     Screen.MousePointer = vbHourglass
  651.     SplitIt.SplitFile
  652.     Screen.MousePointer = vbDefault
  653.     'if the ErrNumber property is <> 0 then we have a problem
  654.     'somthing went wrong in the Split object, to find out,
  655.     'check the ErrMessage property.
  656.     If SplitIt.ErrNumber <> 0 Then
  657.         If SplitIt.ErrNumber <> -1 Then
  658.             MsgBox "Error: " & SplitIt.ErrNumber & " : " & _
  659.                 SplitIt.ErrMessage, vbCritical + vbOKOnly
  660.         Else
  661.             MsgBox SplitIt.ErrMessage, vbCritical + vbOKOnly
  662.         End If
  663.     Else
  664.         'if we are here, it meane the job is done, so lets make the user
  665.         'happy and display the process complete message.
  666.         MsgBox "The file " & txtsplit.Text & Chr(13) & _
  667.                 " has been splitted into " & _
  668.                 SplitIt.SplittedFileCount & _
  669.                 " files each containing  " & _
  670.                 Trim(Text2.Text) & " " & CboSize.List(CboSize.ListIndex) & Chr(13) & _
  671.                 "The last file may contain less then " & _
  672.                 Trim(Text2.Text) & " " & CboSize.List(CboSize.ListIndex), vbInformation + vbOKOnly
  673.         
  674.         'if the user wants to delete the source file (the file that is
  675.         'supposed to be splitted) after split, then
  676.         'get red of it.
  677.         'Note: to set this option click on "Option" icon.
  678.         If chkDelSource.Value Then
  679.             SplitIt.ConfirmDelete = chkDelSourceConfirm.Value
  680.             SplitIt.DeleteSourceFile
  681.         End If
  682.     End If
  683.     'release the instance
  684.     Set SplitIt = Nothing
  685. End Sub
  686. Private Sub cmdSplitDest_Click()
  687.     'pop the destination folder selection form and let
  688.     'the user pick the destination where he/she can save all splitted files
  689.     frmFolders.Show vbModal, Me
  690.     If gDestination <> "" Then
  691.         txtSplitDest.Text = LCase(IIf(Right(gDestination, 1) <> "\", gDestination & "\", gDestination))
  692.     End If
  693. End Sub
  694. Private Sub Form_Load()
  695.     'center the form
  696.     Me.Top = (Screen.Height - Me.Height) / 2
  697.     Me.Left = (Screen.Width - Me.Width) / 2
  698.     'set default split size to Megabyte
  699.     CboSize.ListIndex = 2
  700.     'Add control icons on the ListView
  701.     ListView1.ListItems.Add 1, "SPLIT", "Split Files", "SPLIT"
  702.     ListView1.ListItems.Add 2, "JOIN", "Join Files", "JOIN"
  703.     ListView1.ListItems.Add 3, "TOOLS", "Options", "TOOLS"
  704.     ListView1.ListItems.Add 4, "ABOUT", "About", "ABOUT"
  705.     ListView1.ListItems.Add 5, "EXIT", "Exit", "EXIT"
  706.     Picture1.Item(0).Width = 6585
  707.     Picture1.Item(0).Height = 5653
  708.     Picture1.Item(0).Left = 1595
  709.     'set the caption for the default right panel window
  710.     lblcaption.Caption = "  Split Files"
  711.     SetFrame "SPLIT"
  712.     'get setting from windows registry for the "Option" screen
  713.     'Note: to see these options click on "Option" icon
  714.     chkDelSource.Value = GetRegistryValue(App.EXEName, "Options", "DelSource", 0)
  715.     chkDelSplit.Value = GetRegistryValue(App.EXEName, "Options", "DelSplit", 0)
  716.     chkDelSplitConfirm.Value = GetRegistryValue(App.EXEName, "Options", "DelSplitConfirm", 0)
  717.     chkDelSourceConfirm.Value = GetRegistryValue(App.EXEName, "Options", "DelSourceConfirm", 0)
  718. End Sub
  719. Private Sub Form_Unload(Cancel As Integer)
  720.     'Save setting to windows registry for the "Option" screen
  721.     'Note: to see these options click on "Option" icon
  722.     SaveRegistryValue App.EXEName, "Options", "DelSource", chkDelSource.Value
  723.     SaveRegistryValue App.EXEName, "Options", "DelSplit", chkDelSplit.Value
  724.     SaveRegistryValue App.EXEName, "Options", "DelSplitConfirm", chkDelSplitConfirm.Value
  725.     SaveRegistryValue App.EXEName, "Options", "DelSourceConfirm", chkDelSourceConfirm.Value
  726. End Sub
  727. Private Sub Text2_KeyPress(KeyAscii As Integer)
  728.     'allow only numeric value in Size textbox
  729.     If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 8 And KeyAscii <> 46 Then KeyAscii = 0
  730. End Sub
  731. Private Sub ListView1_Click()
  732.     'do nothing if the user clicks on disabled icon
  733.     If ListView1.SelectedItem.Ghosted Then Exit Sub
  734.         
  735.     ListView1.Refresh
  736.     Dim itemx As ListItem
  737.     Set itemx = ListView1.SelectedItem
  738.     'do nothing if the user clicks on an area other than icons in the listview
  739.     If Not itemx.Selected Then Exit Sub
  740.     'set the label caption
  741.     If itemx.Key <> "EXIT" Then
  742.         lblcaption.Caption = "  " & itemx.Text
  743.     End If
  744.     Dim strKey As String
  745.     strKey = itemx.Key
  746.     Set itemx = Nothing
  747.     ListView1.Tag = ""
  748.     'show/hide frames according to user selection
  749.     SetFrame strKey
  750. End Sub
  751. 'This function shows/hides frames based on user selection in the listview
  752. Function SetFrame(Key As String)
  753.     If Key <> "EXIT" Then
  754.         FraSplit.Visible = False
  755.         FraJoin.Visible = False
  756.         FraOptions.Visible = False
  757.         FraAbout.Visible = False
  758.         
  759.         If ListView2.ListItems.Count > 0 Then
  760.             ListView2.ListItems.Clear
  761.         End If
  762.         ListView2.Visible = True
  763.     End If
  764.     Select Case Key
  765.         Case "SPLIT"
  766.              FraSplit.Visible = True
  767.         Case "JOIN"
  768.              FraJoin.Visible = True
  769.         Case "TOOLS"
  770.             FraOptions.Visible = True
  771.             ListView2.Visible = False
  772.         Case "ABOUT"
  773.             ListView2.Visible = False
  774.             FraAbout.Visible = True
  775.         Case "EXIT"
  776.         
  777.             If MsgBox("Do you wish to close this application?", vbQuestion + vbYesNo) = vbYes Then
  778.                 Unload Me
  779.             End If
  780.     End Select
  781. End Function
  782. 'This function pops the file selection window of CommonDialog control.
  783. Function LocateFile() As String
  784.       With CmDlg
  785.        .Filter = "*.*"
  786.        .InitDir = App.Path
  787.        .FileName = ""
  788.        .ShowOpen
  789.        If Not .CancelError And .FileName <> "" And Dir(.FileName) <> "" Then
  790.           LocateFile = LCase(.FileName)
  791.        Else
  792.           LocateFile = ""
  793.        End If
  794.    End With
  795. End Function
  796.