home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Tool Box
/
SIMS_2.iso
/
tool
/
disktool
/
drvutl
/
drvdemo.frm
< prev
next >
Wrap
Text File
|
1995-02-27
|
14KB
|
500 lines
VERSION 2.00
Begin Form Form1
Caption = "DrvUtils.DLL Test Program"
ClientHeight = 4785
ClientLeft = 1005
ClientTop = 1650
ClientWidth = 3915
Height = 5310
Left = 945
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 4785
ScaleWidth = 3915
Top = 1185
Width = 4035
Begin CommandButton Command5
Caption = "ZAPP This File"
Height = 252
Left = 240
TabIndex = 33
Top = 4440
Width = 1392
End
Begin CommandButton Command4
Caption = "Exit the Demo"
Height = 372
Left = 1860
TabIndex = 32
Top = 4380
Width = 1992
End
Begin CommandButton Command3
Caption = "Set Attributes"
Height = 252
Left = 1860
TabIndex = 31
Top = 4020
Width = 1992
End
Begin CommandButton Command1
Caption = "Set Time/Date"
Height = 252
Left = 60
TabIndex = 30
Top = 4020
Width = 1692
End
Begin CheckBox Check4
Caption = "Archive"
Height = 252
Left = 3000
TabIndex = 29
Top = 3660
Width = 1032
End
Begin CheckBox Check3
Caption = "System"
Height = 252
Left = 3000
TabIndex = 28
Top = 3360
Width = 1032
End
Begin CheckBox Check2
Caption = "Hidden"
Height = 252
Left = 1860
TabIndex = 27
Top = 3660
Width = 1152
End
Begin CheckBox Check1
Caption = "Read Only"
Height = 252
Left = 1860
TabIndex = 26
Top = 3360
Width = 1152
End
Begin TextBox Text6
Height = 288
Left = 840
TabIndex = 24
Top = 3600
Width = 912
End
Begin TextBox Text5
Height = 288
Left = 840
TabIndex = 23
Top = 3300
Width = 912
End
Begin TextBox Text4
Height = 288
Left = 840
TabIndex = 22
Top = 3000
Width = 912
End
Begin TextBox Text3
Height = 288
Left = 840
TabIndex = 21
Top = 2700
Width = 912
End
Begin TextBox Text2
Height = 288
Left = 840
TabIndex = 20
Top = 2100
Width = 912
End
Begin TextBox Text1
Height = 288
Left = 840
TabIndex = 19
Top = 2400
Width = 912
End
Begin FileListBox File1
Height = 1944
Left = 1800
TabIndex = 12
Top = 960
Width = 2112
End
Begin DirListBox Dir1
Height = 1104
Left = 0
TabIndex = 11
Top = 960
Width = 1812
End
Begin DriveListBox Drive1
Height = 288
Left = 0
TabIndex = 0
Top = 0
Width = 1812
End
Begin Line Line3
X1 = 0
X2 = 3900
Y1 = 3960
Y2 = 3960
End
Begin Line Line2
X1 = 1500
X2 = 2460
Y1 = 2220
Y2 = 2580
End
Begin Line Line1
X1 = 0
X2 = 4020
Y1 = 900
Y2 = 900
End
Begin Label Label18
Height = 252
Left = 2700
TabIndex = 34
Top = 3000
Width = 1152
End
Begin Label Label17
Caption = "Size"
Height = 252
Left = 1860
TabIndex = 25
Top = 3000
Width = 792
End
Begin Label Label16
Caption = "Second"
Height = 252
Left = 60
TabIndex = 18
Top = 3600
Width = 732
End
Begin Label Label15
Caption = "Minute"
Height = 252
Left = 60
TabIndex = 17
Top = 3300
Width = 732
End
Begin Label Label14
Caption = "Hour"
Height = 252
Left = 60
TabIndex = 16
Top = 3000
Width = 732
End
Begin Label Label13
Caption = "Year"
Height = 252
Left = 60
TabIndex = 15
Top = 2700
Width = 732
End
Begin Label Label12
Caption = "Month"
Height = 252
Left = 60
TabIndex = 14
Top = 2100
Width = 732
End
Begin Label Label11
Caption = "Day"
Height = 252
Left = 60
TabIndex = 13
Top = 2400
Width = 732
End
Begin Label Label10
Height = 252
Left = 900
TabIndex = 10
Top = 600
Width = 852
End
Begin Label Label9
Height = 252
Left = 900
TabIndex = 9
Top = 300
Width = 852
End
Begin Label Label8
Height = 252
Left = 2580
TabIndex = 8
Top = 600
Width = 1272
End
Begin Label Label7
Height = 252
Left = 2580
TabIndex = 7
Top = 300
Width = 1272
End
Begin Label Label6
Height = 252
Left = 2580
TabIndex = 6
Top = 0
Width = 1272
End
Begin Label Label5
Caption = "Cluster"
Height = 252
Left = 60
TabIndex = 5
Top = 600
Width = 792
End
Begin Label Label4
Caption = "Sector"
Height = 252
Left = 60
TabIndex = 4
Top = 300
Width = 792
End
Begin Label Label3
Caption = "Free"
Height = 252
Left = 1860
TabIndex = 3
Top = 600
Width = 552
End
Begin Label Label2
Caption = "Used"
Height = 252
Left = 1860
TabIndex = 2
Top = 300
Width = 552
End
Begin Label Label1
Caption = "Size"
Height = 252
Left = 1860
TabIndex = 1
Top = 0
Width = 552
End
End
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