home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 31 / CDASC_31_1996_juillet_aout.iso / vrac / altd201a.zip / VB4032.ARJ / VB40.32 / EX24VB.FRM < prev    next >
Text File  |  1996-04-19  |  9KB  |  292 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "VB Example 24"
  4.    ClientHeight    =   4665
  5.    ClientLeft      =   1155
  6.    ClientTop       =   1635
  7.    ClientWidth     =   7260
  8.    Height          =   5070
  9.    Left            =   1095
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   4665
  12.    ScaleWidth      =   7260
  13.    Top             =   1290
  14.    Width           =   7380
  15.    Begin VB.CommandButton UpdateZipComment 
  16.       Caption         =   "Update ZIP Comment"
  17.       Height          =   375
  18.       Left            =   5280
  19.       TabIndex        =   21
  20.       Top             =   600
  21.       Width           =   1815
  22.    End
  23.    Begin VB.CommandButton WriteDirectory 
  24.       Caption         =   "Write Directory"
  25.       Height          =   375
  26.       Left            =   5280
  27.       TabIndex        =   20
  28.       Top             =   1080
  29.       Width           =   1815
  30.    End
  31.    Begin VB.CommandButton UpdateFileComment 
  32.       Caption         =   "Update File Comment"
  33.       Height          =   375
  34.       Left            =   5280
  35.       TabIndex        =   19
  36.       Top             =   120
  37.       Width           =   1815
  38.    End
  39.    Begin VB.TextBox ArchiveComment 
  40.       Height          =   375
  41.       Left            =   1920
  42.       TabIndex        =   18
  43.       Text            =   "Archive Comment"
  44.       Top             =   3240
  45.       Width           =   1575
  46.    End
  47.    Begin VB.CommandButton Exit 
  48.       Caption         =   "Exit"
  49.       Height          =   375
  50.       Left            =   3720
  51.       TabIndex        =   17
  52.       Top             =   1080
  53.       Width           =   1335
  54.    End
  55.    Begin VB.CommandButton About 
  56.       Caption         =   "About"
  57.       Height          =   375
  58.       Left            =   3720
  59.       TabIndex        =   16
  60.       Top             =   600
  61.       Width           =   1335
  62.    End
  63.    Begin VB.TextBox Level 
  64.       Height          =   375
  65.       Left            =   3840
  66.       TabIndex        =   15
  67.       Text            =   "Level"
  68.       Top             =   1680
  69.       Width           =   1575
  70.    End
  71.    Begin VB.CheckBox Directory 
  72.       Caption         =   "Directory"
  73.       Height          =   375
  74.       Left            =   3840
  75.       TabIndex        =   14
  76.       Top             =   4200
  77.       Width           =   975
  78.    End
  79.    Begin VB.CheckBox Hidden 
  80.       Caption         =   "Hidden"
  81.       Height          =   375
  82.       Left            =   3840
  83.       TabIndex        =   13
  84.       Top             =   3720
  85.       Width           =   855
  86.    End
  87.    Begin VB.CheckBox System 
  88.       Caption         =   "System"
  89.       Height          =   375
  90.       Left            =   3840
  91.       TabIndex        =   12
  92.       Top             =   3240
  93.       Width           =   975
  94.    End
  95.    Begin VB.CheckBox Archive 
  96.       Caption         =   "Archive"
  97.       Height          =   375
  98.       Left            =   3840
  99.       TabIndex        =   11
  100.       Top             =   2760
  101.       Width           =   975
  102.    End
  103.    Begin VB.CheckBox ReadOnly 
  104.       Caption         =   "ReadOnly"
  105.       Height          =   375
  106.       Left            =   3840
  107.       TabIndex        =   10
  108.       Top             =   2280
  109.       Width           =   1095
  110.    End
  111.    Begin VB.TextBox TimeStamp 
  112.       Height          =   375
  113.       Left            =   1920
  114.       TabIndex        =   9
  115.       Text            =   "TimeStamp"
  116.       Top             =   2760
  117.       Width           =   1575
  118.    End
  119.    Begin VB.TextBox DateStamp 
  120.       Height          =   375
  121.       Left            =   1920
  122.       TabIndex        =   8
  123.       Text            =   "DateStamp"
  124.       Top             =   2280
  125.       Width           =   1575
  126.    End
  127.    Begin VB.TextBox crc 
  128.       Height          =   375
  129.       Left            =   240
  130.       TabIndex        =   7
  131.       Text            =   "crc"
  132.       Top             =   4200
  133.       Width           =   1575
  134.    End
  135.    Begin VB.TextBox Size 
  136.       Height          =   375
  137.       Left            =   240
  138.       TabIndex        =   6
  139.       Text            =   "Size"
  140.       Top             =   3240
  141.       Width           =   1575
  142.    End
  143.    Begin VB.TextBox CompressedSize 
  144.       Height          =   375
  145.       Left            =   240
  146.       TabIndex        =   5
  147.       Text            =   "CompressedSize"
  148.       Top             =   3720
  149.       Width           =   1575
  150.    End
  151.    Begin VB.TextBox Comment 
  152.       Height          =   375
  153.       Left            =   240
  154.       TabIndex        =   4
  155.       Text            =   "Comment"
  156.       Top             =   2760
  157.       Width           =   1575
  158.    End
  159.    Begin VB.TextBox FileName 
  160.       Height          =   375
  161.       Left            =   240
  162.       TabIndex        =   3
  163.       Text            =   "Text1"
  164.       Top             =   2280
  165.       Width           =   1575
  166.    End
  167.    Begin VB.ListBox Contents 
  168.       Height          =   2010
  169.       Left            =   1800
  170.       TabIndex        =   2
  171.       Top             =   120
  172.       Width           =   1695
  173.    End
  174.    Begin VB.CommandButton Command1 
  175.       Caption         =   "Read Archive"
  176.       Height          =   375
  177.       Left            =   3720
  178.       TabIndex        =   1
  179.       Top             =   120
  180.       Width           =   1335
  181.    End
  182.    Begin VB.FileListBox File1
  183.       Height          =   2010
  184.       Left            =   120
  185.       Pattern         =   "*.zip"
  186.       TabIndex        =   0
  187.       Top             =   120
  188.       Width           =   1575
  189.    End
  190. End
  191. Attribute VB_Name = "Form1"
  192. Attribute VB_Creatable = False
  193. Attribute VB_Exposed = False
  194. Dim z() As ALZipDir
  195. Dim LibraryHandle As Long
  196.  
  197. Private Sub About_Click()
  198.   frmAbout.Text1 = "EX24VB demonstrates the simplified interface.  Double click on a"
  199.   frmAbout.Text1 = frmAbout.Text1 + " zip file to display its contents.  Selecting individual"
  200.   frmAbout.Text1 = frmAbout.Text1 + " files shows the file's attributes.  You can change the"
  201.   frmAbout.Text1 = frmAbout.Text1 + " file and archive comments by inputing a new comment and"
  202.   frmAbout.Text1 = frmAbout.Text1 + " pressing the Update File/ZIP Comment button, then pressing"
  203.   frmAbout.Text1 = frmAbout.Text1 + " Write Directory."
  204.   frmAbout.Show 1
  205. End Sub
  206.  
  207.  
  208. Private Sub Command1_Click()
  209.     Dim i As Integer
  210.     Dim count As Long
  211.     Dim error As Long
  212.     ALFreeDir z()
  213.     If File1.filename <> "" Then
  214.         Contents.Clear
  215.         ALReadDir z(), File1.filename, count, error
  216.         For i = 0 To count - 1
  217.             Contents.AddItem (z(i).name)
  218.         Next i
  219.     End If
  220. '
  221. ' I'm not going to do a WriteDir, a Delete, or
  222. ' anything like that, so I'll just free up the
  223. ' archive handle right away
  224. '
  225.   ArchiveComment.text = z(UBound(z, 1)).comment
  226. End Sub
  227.  
  228.  
  229. Private Sub Contents_Click()
  230.     Dim i As Integer
  231.     i = Contents.ListIndex
  232.     If i >= LBound(z, 1) And i <= UBound(z, 1) Then
  233.         filename.text = z(i).name
  234.         comment.text = z(i).comment
  235.         size.text = Str(z(i).size)
  236.         CompressedSize.text = Str(z(i).compressed_size)
  237.         crc.text = Hex$(Not z(i).crc)
  238.         Datestamp.text = Format(z(i).month, "00/") + Format(z(i).date, "00/") + Format(z(i).year, "0000")
  239.         TimeStamp.text = Format(z(i).hour, "00:") + Format(z(i).minute, "00:") + Format(z(i).second, "00")
  240.         If z(i).r <> 0 Then ReadOnly.Value = 1 Else ReadOnly.Value = 0
  241.         If z(i).a <> 0 Then Archive.Value = 1 Else Archive.Value = 0
  242.         If z(i).s <> 0 Then System.Value = 1 Else System.Value = 0
  243.         If z(i).h <> 0 Then Hidden.Value = 1 Else Hidden.Value = 0
  244.         If z(i).d <> 0 Then Directory.Value = 1 Else Directory.Value = 0
  245.         level.text = Str(z(i).level)
  246.     End If
  247. End Sub
  248.  
  249. Private Sub Exit_Click()
  250.   Unload Form1
  251.   End
  252. End Sub
  253.  
  254. Private Sub File1_DblClick()
  255.     Command1_Click
  256. End Sub
  257.  
  258.  
  259. Private Sub Form_Load()
  260.     ChDrive App.Path
  261.     ChDir App.Path
  262.     File1.Path = App.Path
  263.     LibraryHandle = LoadLibrary(DLLName)
  264.     ReDim z(0)
  265. End Sub
  266.  
  267.  
  268. Private Sub Form_Unload(Cancel As Integer)
  269.   ALFreeDir z
  270.   FreeLibrary (LibraryHandle)
  271. End Sub
  272.  
  273.  
  274. Private Sub UpdateFileComment_Click()
  275.     Dim i As Integer
  276.     i = Contents.ListIndex
  277.     If i >= LBound(z, 1) And i <= UBound(z, 1) Then
  278.         z(i).comment = comment.text
  279.     End If
  280. End Sub
  281.  
  282.  
  283. Private Sub UpdateZipComment_Click()
  284.   z(UBound(z, 1)).comment = ArchiveComment.text
  285. End Sub
  286.  
  287. Private Sub WriteDirectory_Click()
  288.     i = ALWriteDir(z())
  289. End Sub
  290.  
  291.  
  292.