home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Tool Box
/
SIMS_2.iso
/
tool
/
disktool
/
drvutl
/
drvdemo.txt
< prev
next >
Wrap
Text File
|
1995-02-27
|
6KB
|
201 lines
Option Explicit
Sub Command1_Click ()
Dim Stat As Integer
Dim Ayear As Integer
Dim Amonth As Integer
Dim Aday As Integer
Dim Ahour As Integer
Dim Aminute As Integer
Dim Asecond As Integer
Dim FName As String
'Build the full file name
If (Right$(File1.Path, 1) = "\") Then
FName = File1.Path + File1.FileName
Else
FName = File1.Path + "\" + File1.FileName
End If
'Collect the user's new date/time stamp
Aday = Val(Text1.Text)
Amonth = Val(Text2.Text)
Ayear = Val(Text3.Text)
Ahour = Val(Text4.Text)
Aminute = Val(Text5.Text)
Asecond = Val(Text6.Text)
Stat = MsgBox("Are you sure you want to change date/time?", 4)
If (Stat = 6) Then
'Call the Drive Utilities DLL routine
Stat = FileSetDateTime(FName, Ayear, Amonth, Aday, Ahour, Aminute, Asecond)
File1_DblClick
End If
End Sub
Sub Command3_Click ()
Dim Stat As Integer
Dim Attribute As Integer
Dim FName As String
'Build the full file name
If (Right$(File1.Path, 1) = "\") Then
FName = File1.Path + File1.FileName
Else
FName = File1.Path + "\" + File1.FileName
End If
'Turn on attribute bits based on check boxes
Attribute = 0
If (Check1.Value = 1) Then
Attribute = Attribute + A_RDONLY
End If
If (Check2.Value = 1) Then
Attribute = Attribute + A_HIDDEN
End If
If (Check3.Value = 1) Then
Attribute = Attribute + A_SYSTEM
End If
If (Check4.Value = 1) Then
Attribute = Attribute + A_ARCH
End If
Stat = MsgBox("Are you sure you want to change attributes?", 4)
If (Stat = 6) Then
'Call the Drive Utilities DLL routine
Stat = FileSetAttributes(FName, Attribute)
File1_DblClick
End If
End Sub
Sub Command4_Click ()
End
End Sub
Sub Command5_Click ()
Dim Stat As Integer
Dim FName As String
'Build the full file name
If (Right$(File1.Path, 1) = "\") Then
FName = File1.Path + File1.FileName
Else
FName = File1.Path + "\" + File1.FileName
End If
'Make sure they REALLY want to zapp the file
Stat = MsgBox("Are you sure you want to ZAPP this file?", 4)
If (Stat = 6) Then
Stat = MsgBox("This will COMPLETELY KILL this file! Continue?", 4)
If (Stat = 6) Then
'Call the Drive Utilities DLL routine
Stat = FileZAPP(FName, 0)
File1.Refresh
File1_DblClick
End If
End If
End Sub
Sub Dir1_Change ()
If (Right$(Dir1.Path, 1) = "\") Then
File1.FileName = Dir1.Path + "*.*"
Else
File1.FileName = Dir1.Path + "\*.*"
End If
End Sub
Sub Drive1_Change ()
Dim Drv As String
Dim BTotal As Long
Dim BUsed As Long
Dim BFree As Long
Dim BSector As Long
Dim BCluster As Long
'Get the drive, to pass to DRVUTILS.DLL
Drv = Drive1.Drive
Dir1.Path = Drv + "\"
'Now, get all of the information
BTotal = DiskBytesTotal(Drv)
BUsed = DiskBytesUsed(Drv)
BFree = DiskBytesFree(Drv)
BSector = DiskBytesSector(Drv)
BCluster = DiskBytesCluster(Drv)
'Now put information on form
Label6.Caption = Format$(BTotal, "#,##0")
Label7.Caption = Format$(BUsed, "#,##0")
Label8.Caption = Format$(BFree, "#,##0")
Label9.Caption = Format$(BSector, "#,##0")
Label10.Caption = Format$(BCluster, "#,##0")
End Sub
Sub File1_DblClick ()
Dim Stat As Integer
Dim FName As String
Dim FSiz As Long
Dim FAttr As Integer
Dim Ayear As Integer
Dim Amonth As Integer
Dim Aday As Integer
Dim Ahour As Integer
Dim Aminute As Integer
Dim Asecond As Integer
'Build the full file name
If (Right$(File1.Path, 1) = "\") Then
FName = File1.Path + File1.FileName
Else
FName = File1.Path + "\" + File1.FileName
End If
'Now call the Get routines
Stat = FileGetDateTime(FName, Ayear, Amonth, Aday, Ahour, Aminute, Asecond)
FSiz = FileGetBytes(FName)
FAttr = FileGetAttributes(FName)
'Now display the results
Text1.Text = Str$(Aday)
Text2.Text = Str$(Amonth)
Text3.Text = Str$(Ayear)
Text4.Text = Str$(Ahour)
Text5.Text = Str$(Aminute)
Text6.Text = Str$(Asecond)
Label18.Caption = Str$(FSiz)
'Extract attribute information
'See if file is read only
If (FAttr And A_RDONLY) Then
Check1.Value = 1
Else
Check1.Value = 0
End If
'See if file is hidden
If (FAttr And A_HIDDEN) Then
Check2.Value = 1
Else
Check2.Value = 0
End If
'See if file is a system file
If (FAttr And A_SYSTEM) Then
Check3.Value = 1
Else
Check3.Value = 0
End If
'See if archive bit is set
If (FAttr And A_ARCH) Then
Check4.Value = 1
Else
Check4.Value = 0
End If
End Sub
Sub Form_Load ()
Dim BTotal As Long
Dim BUsed As Long
Dim BFree As Long
Dim BSector As Long
Dim BCluster As Long
'Now, get all of the information
BTotal = DiskBytesTotal("")
BUsed = DiskBytesUsed("")
BFree = DiskBytesFree("")
BSector = DiskBytesSector("")
BCluster = DiskBytesCluster("")
'Now put information on form
Label6.Caption = Format$(BTotal, "#,##0")
Label7.Caption = Format$(BUsed, "#,##0")
Label8.Caption = Format$(BFree, "#,##0")
Label9.Caption = Format$(BSector, "#,##0")
Label10.Caption = Format$(BCluster, "#,##0")
End Sub