home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / tool / disktool / drvutl / drvdemo.txt < prev    next >
Text File  |  1995-02-27  |  6KB  |  201 lines

  1. Option Explicit
  2.  
  3. Sub Command1_Click ()
  4.     Dim Stat As Integer
  5.     Dim Ayear As Integer
  6.     Dim Amonth As Integer
  7.     Dim Aday As Integer
  8.     Dim Ahour As Integer
  9.     Dim Aminute As Integer
  10.     Dim Asecond As Integer
  11.     Dim FName As String
  12.     'Build the full file name
  13.     If (Right$(File1.Path, 1) = "\") Then
  14.         FName = File1.Path + File1.FileName
  15.     Else
  16.         FName = File1.Path + "\" + File1.FileName
  17.     End If
  18.     'Collect the user's new date/time stamp
  19.     Aday = Val(Text1.Text)
  20.     Amonth = Val(Text2.Text)
  21.     Ayear = Val(Text3.Text)
  22.     Ahour = Val(Text4.Text)
  23.     Aminute = Val(Text5.Text)
  24.     Asecond = Val(Text6.Text)
  25.     Stat = MsgBox("Are you sure you want to change date/time?", 4)
  26.     If (Stat = 6) Then
  27.         'Call the Drive Utilities DLL routine
  28.         Stat = FileSetDateTime(FName, Ayear, Amonth, Aday, Ahour, Aminute, Asecond)
  29.         File1_DblClick
  30.     End If
  31. End Sub
  32.  
  33. Sub Command3_Click ()
  34.     Dim Stat As Integer
  35.     Dim Attribute As Integer
  36.     Dim FName As String
  37.     'Build the full file name
  38.     If (Right$(File1.Path, 1) = "\") Then
  39.         FName = File1.Path + File1.FileName
  40.     Else
  41.         FName = File1.Path + "\" + File1.FileName
  42.     End If
  43.     'Turn on attribute bits based on check boxes
  44.     Attribute = 0
  45.     If (Check1.Value = 1) Then
  46.         Attribute = Attribute + A_RDONLY
  47.     End If
  48.     If (Check2.Value = 1) Then
  49.         Attribute = Attribute + A_HIDDEN
  50.     End If
  51.     If (Check3.Value = 1) Then
  52.         Attribute = Attribute + A_SYSTEM
  53.     End If
  54.     If (Check4.Value = 1) Then
  55.         Attribute = Attribute + A_ARCH
  56.     End If
  57.     Stat = MsgBox("Are you sure you want to change attributes?", 4)
  58.     If (Stat = 6) Then
  59.         'Call the Drive Utilities DLL routine
  60.         Stat = FileSetAttributes(FName, Attribute)
  61.         File1_DblClick
  62.     End If
  63. End Sub
  64.  
  65. Sub Command4_Click ()
  66.     End
  67. End Sub
  68.  
  69. Sub Command5_Click ()
  70.     Dim Stat As Integer
  71.     Dim FName As String
  72.     'Build the full file name
  73.     If (Right$(File1.Path, 1) = "\") Then
  74.         FName = File1.Path + File1.FileName
  75.     Else
  76.         FName = File1.Path + "\" + File1.FileName
  77.     End If
  78.     'Make sure they REALLY want to zapp the file
  79.     Stat = MsgBox("Are you sure you want to ZAPP this file?", 4)
  80.     If (Stat = 6) Then
  81.         Stat = MsgBox("This will COMPLETELY KILL this file!  Continue?", 4)
  82.         If (Stat = 6) Then
  83.             'Call the Drive Utilities DLL routine
  84.             Stat = FileZAPP(FName, 0)
  85.             File1.Refresh
  86.             File1_DblClick
  87.         End If
  88.     End If
  89. End Sub
  90.  
  91. Sub Dir1_Change ()
  92.     If (Right$(Dir1.Path, 1) = "\") Then
  93.         File1.FileName = Dir1.Path + "*.*"
  94.     Else
  95.         File1.FileName = Dir1.Path + "\*.*"
  96.     End If
  97. End Sub
  98.  
  99. Sub Drive1_Change ()
  100.     Dim Drv As String
  101.     Dim BTotal As Long
  102.     Dim BUsed As Long
  103.     Dim BFree As Long
  104.     Dim BSector As Long
  105.     Dim BCluster As Long
  106.     'Get the drive, to pass to DRVUTILS.DLL
  107.     Drv = Drive1.Drive
  108.     Dir1.Path = Drv + "\"
  109.     'Now, get all of the information
  110.     BTotal = DiskBytesTotal(Drv)
  111.     BUsed = DiskBytesUsed(Drv)
  112.     BFree = DiskBytesFree(Drv)
  113.     BSector = DiskBytesSector(Drv)
  114.     BCluster = DiskBytesCluster(Drv)
  115.     'Now put information on form
  116.     Label6.Caption = Format$(BTotal, "#,##0")
  117.     Label7.Caption = Format$(BUsed, "#,##0")
  118.     Label8.Caption = Format$(BFree, "#,##0")
  119.     Label9.Caption = Format$(BSector, "#,##0")
  120.     Label10.Caption = Format$(BCluster, "#,##0")
  121. End Sub
  122.  
  123. Sub File1_DblClick ()
  124.     Dim Stat As Integer
  125.     Dim FName As String
  126.     Dim FSiz As Long
  127.     Dim FAttr As Integer
  128.  
  129.     Dim Ayear As Integer
  130.     Dim Amonth As Integer
  131.     Dim Aday As Integer
  132.     Dim Ahour As Integer
  133.     Dim Aminute As Integer
  134.     Dim Asecond As Integer
  135.  
  136.     'Build the full file name
  137.     If (Right$(File1.Path, 1) = "\") Then
  138.         FName = File1.Path + File1.FileName
  139.     Else
  140.         FName = File1.Path + "\" + File1.FileName
  141.     End If
  142.     'Now call the Get routines
  143.     Stat = FileGetDateTime(FName, Ayear, Amonth, Aday, Ahour, Aminute, Asecond)
  144.     FSiz = FileGetBytes(FName)
  145.     FAttr = FileGetAttributes(FName)
  146.     'Now display the results
  147.     Text1.Text = Str$(Aday)
  148.     Text2.Text = Str$(Amonth)
  149.     Text3.Text = Str$(Ayear)
  150.     Text4.Text = Str$(Ahour)
  151.     Text5.Text = Str$(Aminute)
  152.     Text6.Text = Str$(Asecond)
  153.     Label18.Caption = Str$(FSiz)
  154.     'Extract attribute information
  155.     'See if file is read only
  156.     If (FAttr And A_RDONLY) Then
  157.         Check1.Value = 1
  158.     Else
  159.         Check1.Value = 0
  160.     End If
  161.     'See if file is hidden
  162.     If (FAttr And A_HIDDEN) Then
  163.         Check2.Value = 1
  164.     Else
  165.         Check2.Value = 0
  166.     End If
  167.     'See if file is a system file
  168.     If (FAttr And A_SYSTEM) Then
  169.         Check3.Value = 1
  170.     Else
  171.         Check3.Value = 0
  172.     End If
  173.     'See if archive bit is set
  174.     If (FAttr And A_ARCH) Then
  175.         Check4.Value = 1
  176.     Else
  177.         Check4.Value = 0
  178.     End If
  179. End Sub
  180.  
  181. Sub Form_Load ()
  182.     Dim BTotal As Long
  183.     Dim BUsed As Long
  184.     Dim BFree As Long
  185.     Dim BSector As Long
  186.     Dim BCluster As Long
  187.     'Now, get all of the information
  188.     BTotal = DiskBytesTotal("")
  189.     BUsed = DiskBytesUsed("")
  190.     BFree = DiskBytesFree("")
  191.     BSector = DiskBytesSector("")
  192.     BCluster = DiskBytesCluster("")
  193.     'Now put information on form
  194.     Label6.Caption = Format$(BTotal, "#,##0")
  195.     Label7.Caption = Format$(BUsed, "#,##0")
  196.     Label8.Caption = Format$(BFree, "#,##0")
  197.     Label9.Caption = Format$(BSector, "#,##0")
  198.     Label10.Caption = Format$(BCluster, "#,##0")
  199. End Sub
  200.  
  201.