home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / VISUAL_B / CODIGO_1 / DRV_UTIL / DRVDEMO.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-03-06  |  13.6 KB  |  488 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "DrvUtils.DLL Test Program"
  4.    ClientHeight    =   4788
  5.    ClientLeft      =   1008
  6.    ClientTop       =   1644
  7.    ClientWidth     =   3912
  8.    Height          =   5232
  9.    Left            =   948
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    ScaleHeight     =   4788
  13.    ScaleWidth      =   3912
  14.    Top             =   1260
  15.    Width           =   4032
  16.    Begin CommandButton Command5 
  17.       Caption         =   "ZAPP This File"
  18.       Height          =   252
  19.       Left            =   240
  20.       TabIndex        =   33
  21.       Top             =   4440
  22.       Width           =   1392
  23.    End
  24.    Begin CommandButton Command4 
  25.       Caption         =   "Exit the Demo"
  26.       Height          =   372
  27.       Left            =   1860
  28.       TabIndex        =   32
  29.       Top             =   4380
  30.       Width           =   1992
  31.    End
  32.    Begin CommandButton Command3 
  33.       Caption         =   "Set Attributes"
  34.       Height          =   252
  35.       Left            =   1860
  36.       TabIndex        =   31
  37.       Top             =   4020
  38.       Width           =   1992
  39.    End
  40.    Begin CommandButton Command1 
  41.       Caption         =   "Set Time/Date"
  42.       Height          =   252
  43.       Left            =   60
  44.       TabIndex        =   30
  45.       Top             =   4020
  46.       Width           =   1692
  47.    End
  48.    Begin CheckBox Check4 
  49.       Caption         =   "Archive"
  50.       Height          =   252
  51.       Left            =   3000
  52.       TabIndex        =   29
  53.       Top             =   3660
  54.       Width           =   1032
  55.    End
  56.    Begin CheckBox Check3 
  57.       Caption         =   "System"
  58.       Height          =   252
  59.       Left            =   3000
  60.       TabIndex        =   28
  61.       Top             =   3360
  62.       Width           =   1032
  63.    End
  64.    Begin CheckBox Check2 
  65.       Caption         =   "Hidden"
  66.       Height          =   252
  67.       Left            =   1860
  68.       TabIndex        =   27
  69.       Top             =   3660
  70.       Width           =   1152
  71.    End
  72.    Begin CheckBox Check1 
  73.       Caption         =   "Read Only"
  74.       Height          =   252
  75.       Left            =   1860
  76.       TabIndex        =   26
  77.       Top             =   3360
  78.       Width           =   1152
  79.    End
  80.    Begin TextBox Text6 
  81.       Height          =   288
  82.       Left            =   840
  83.       TabIndex        =   24
  84.       Top             =   3600
  85.       Width           =   912
  86.    End
  87.    Begin TextBox Text5 
  88.       Height          =   288
  89.       Left            =   840
  90.       TabIndex        =   23
  91.       Top             =   3300
  92.       Width           =   912
  93.    End
  94.    Begin TextBox Text4 
  95.       Height          =   288
  96.       Left            =   840
  97.       TabIndex        =   22
  98.       Top             =   3000
  99.       Width           =   912
  100.    End
  101.    Begin TextBox Text3 
  102.       Height          =   288
  103.       Left            =   840
  104.       TabIndex        =   21
  105.       Top             =   2700
  106.       Width           =   912
  107.    End
  108.    Begin TextBox Text2 
  109.       Height          =   288
  110.       Left            =   840
  111.       TabIndex        =   20
  112.       Top             =   2100
  113.       Width           =   912
  114.    End
  115.    Begin TextBox Text1 
  116.       Height          =   288
  117.       Left            =   840
  118.       TabIndex        =   19
  119.       Top             =   2400
  120.       Width           =   912
  121.    End
  122.    Begin FileListBox File1 
  123.       Height          =   1944
  124.       Left            =   1800
  125.       TabIndex        =   12
  126.       Top             =   960
  127.       Width           =   2112
  128.    End
  129.    Begin DirListBox Dir1 
  130.       Height          =   1104
  131.       Left            =   0
  132.       TabIndex        =   11
  133.       Top             =   960
  134.       Width           =   1812
  135.    End
  136.    Begin DriveListBox Drive1 
  137.       Height          =   288
  138.       Left            =   0
  139.       TabIndex        =   0
  140.       Top             =   0
  141.       Width           =   1812
  142.    End
  143.    Begin Line Line3 
  144.       X1              =   0
  145.       X2              =   3900
  146.       Y1              =   3960
  147.       Y2              =   3960
  148.    End
  149.    Begin Line Line2 
  150.       X1              =   1500
  151.       X2              =   2460
  152.       Y1              =   2220
  153.       Y2              =   2580
  154.    End
  155.    Begin Line Line1 
  156.       X1              =   0
  157.       X2              =   4020
  158.       Y1              =   900
  159.       Y2              =   900
  160.    End
  161.    Begin Label Label18 
  162.       Height          =   252
  163.       Left            =   2700
  164.       TabIndex        =   34
  165.       Top             =   3000
  166.       Width           =   1152
  167.    End
  168.    Begin Label Label17 
  169.       Caption         =   "Size"
  170.       Height          =   252
  171.       Left            =   1860
  172.       TabIndex        =   25
  173.       Top             =   3000
  174.       Width           =   792
  175.    End
  176.    Begin Label Label16 
  177.       Caption         =   "Second"
  178.       Height          =   252
  179.       Left            =   60
  180.       TabIndex        =   18
  181.       Top             =   3600
  182.       Width           =   732
  183.    End
  184.    Begin Label Label15 
  185.       Caption         =   "Minute"
  186.       Height          =   252
  187.       Left            =   60
  188.       TabIndex        =   17
  189.       Top             =   3300
  190.       Width           =   732
  191.    End
  192.    Begin Label Label14 
  193.       Caption         =   "Hour"
  194.       Height          =   252
  195.       Left            =   60
  196.       TabIndex        =   16
  197.       Top             =   3000
  198.       Width           =   732
  199.    End
  200.    Begin Label Label13 
  201.       Caption         =   "Year"
  202.       Height          =   252
  203.       Left            =   60
  204.       TabIndex        =   15
  205.       Top             =   2700
  206.       Width           =   732
  207.    End
  208.    Begin Label Label12 
  209.       Caption         =   "Month"
  210.       Height          =   252
  211.       Left            =   60
  212.       TabIndex        =   14
  213.       Top             =   2100
  214.       Width           =   732
  215.    End
  216.    Begin Label Label11 
  217.       Caption         =   "Day"
  218.       Height          =   252
  219.       Left            =   60
  220.       TabIndex        =   13
  221.       Top             =   2400
  222.       Width           =   732
  223.    End
  224.    Begin Label Label10 
  225.       Height          =   252
  226.       Left            =   900
  227.       TabIndex        =   10
  228.       Top             =   600
  229.       Width           =   852
  230.    End
  231.    Begin Label Label9 
  232.       Height          =   252
  233.       Left            =   900
  234.       TabIndex        =   9
  235.       Top             =   300
  236.       Width           =   852
  237.    End
  238.    Begin Label Label8 
  239.       Height          =   252
  240.       Left            =   2580
  241.       TabIndex        =   8
  242.       Top             =   600
  243.       Width           =   1272
  244.    End
  245.    Begin Label Label7 
  246.       Height          =   252
  247.       Left            =   2580
  248.       TabIndex        =   7
  249.       Top             =   300
  250.       Width           =   1272
  251.    End
  252.    Begin Label Label6 
  253.       Height          =   252
  254.       Left            =   2580
  255.       TabIndex        =   6
  256.       Top             =   0
  257.       Width           =   1272
  258.    End
  259.    Begin Label Label5 
  260.       Caption         =   "Cluster"
  261.       Height          =   252
  262.       Left            =   60
  263.       TabIndex        =   5
  264.       Top             =   600
  265.       Width           =   792
  266.    End
  267.    Begin Label Label4 
  268.       Caption         =   "Sector"
  269.       Height          =   252
  270.       Left            =   60
  271.       TabIndex        =   4
  272.       Top             =   300
  273.       Width           =   792
  274.    End
  275.    Begin Label Label3 
  276.       Caption         =   "Free"
  277.       Height          =   252
  278.       Left            =   1860
  279.       TabIndex        =   3
  280.       Top             =   600
  281.       Width           =   552
  282.    End
  283.    Begin Label Label2 
  284.       Caption         =   "Used"
  285.       Height          =   252
  286.       Left            =   1860
  287.       TabIndex        =   2
  288.       Top             =   300
  289.       Width           =   552
  290.    End
  291.    Begin Label Label1 
  292.       Caption         =   "Size"
  293.       Height          =   252
  294.       Left            =   1860
  295.       TabIndex        =   1
  296.       Top             =   0
  297.       Width           =   552
  298.    End
  299. Option Explicit
  300. Sub Command1_Click ()
  301.     Dim Stat As Integer
  302.     Dim Ayear As Integer
  303.     Dim Amonth As Integer
  304.     Dim Aday As Integer
  305.     Dim Ahour As Integer
  306.     Dim Aminute As Integer
  307.     Dim Asecond As Integer
  308.     Dim FName As String
  309.     'Build the full file name
  310.     If (Right$(File1.Path, 1) = "\") Then
  311.         FName = File1.Path + File1.FileName
  312.     Else
  313.         FName = File1.Path + "\" + File1.FileName
  314.     End If
  315.     'Collect the user's new date/time stamp
  316.     Aday = Val(Text1.Text)
  317.     Amonth = Val(Text2.Text)
  318.     Ayear = Val(Text3.Text)
  319.     Ahour = Val(Text4.Text)
  320.     Aminute = Val(Text5.Text)
  321.     Asecond = Val(Text6.Text)
  322.     Stat = MsgBox("Are you sure you want to change date/time?", 4)
  323.     If (Stat = 6) Then
  324.         'Call the Drive Utilities DLL routine
  325.         Stat = FileSetDateTime(FName, Ayear, Amonth, Aday, Ahour, Aminute, Asecond)
  326.         File1_DblClick
  327.     End If
  328. End Sub
  329. Sub Command3_Click ()
  330.     Dim Stat As Integer
  331.     Dim Attribute As Integer
  332.     Dim FName As String
  333.     'Build the full file name
  334.     If (Right$(File1.Path, 1) = "\") Then
  335.         FName = File1.Path + File1.FileName
  336.     Else
  337.         FName = File1.Path + "\" + File1.FileName
  338.     End If
  339.     'Turn on attribute bits based on check boxes
  340.     Attribute = 0
  341.     If (Check1.Value = 1) Then
  342.         Attribute = Attribute + A_RDONLY
  343.     End If
  344.     If (Check2.Value = 1) Then
  345.         Attribute = Attribute + A_HIDDEN
  346.     End If
  347.     If (Check3.Value = 1) Then
  348.         Attribute = Attribute + A_SYSTEM
  349.     End If
  350.     If (Check4.Value = 1) Then
  351.         Attribute = Attribute + A_ARCH
  352.     End If
  353.     Stat = MsgBox("Are you sure you want to change attributes?", 4)
  354.     If (Stat = 6) Then
  355.         'Call the Drive Utilities DLL routine
  356.         Stat = FileSetAttributes(FName, Attribute)
  357.         File1_DblClick
  358.     End If
  359. End Sub
  360. Sub Command4_Click ()
  361.     End
  362. End Sub
  363. Sub Command5_Click ()
  364.     Dim Stat As Integer
  365.     Dim FName As String
  366.     'Build the full file name
  367.     If (Right$(File1.Path, 1) = "\") Then
  368.         FName = File1.Path + File1.FileName
  369.     Else
  370.         FName = File1.Path + "\" + File1.FileName
  371.     End If
  372.     'Make sure they REALLY want to zapp the file
  373.     Stat = MsgBox("Are you sure you want to ZAPP this file?", 4)
  374.     If (Stat = 6) Then
  375.         Stat = MsgBox("This will COMPLETELY KILL this file!  Continue?", 4)
  376.         If (Stat = 6) Then
  377.             'Call the Drive Utilities DLL routine
  378.             Stat = FileZAPP(FName, 0)
  379.             File1.Refresh
  380.             File1_DblClick
  381.         End If
  382.     End If
  383. End Sub
  384. Sub Dir1_Change ()
  385.     If (Right$(Dir1.Path, 1) = "\") Then
  386.         File1.FileName = Dir1.Path + "*.*"
  387.     Else
  388.         File1.FileName = Dir1.Path + "\*.*"
  389.     End If
  390. End Sub
  391. Sub Drive1_Change ()
  392.     Dim Drv As String
  393.     Dim BTotal As Long
  394.     Dim BUsed As Long
  395.     Dim BFree As Long
  396.     Dim BSector As Long
  397.     Dim BCluster As Long
  398.     'Get the drive, to pass to DRVUTILS.DLL
  399.     Drv = Drive1.Drive
  400.     Dir1.Path = Drv + "\"
  401.     'Now, get all of the information
  402.     BTotal = DiskBytesTotal(Drv)
  403.     BUsed = DiskBytesUsed(Drv)
  404.     BFree = DiskBytesFree(Drv)
  405.     BSector = DiskBytesSector(Drv)
  406.     BCluster = DiskBytesCluster(Drv)
  407.     'Now put information on form
  408.     Label6.Caption = Format$(BTotal, "#,##0")
  409.     Label7.Caption = Format$(BUsed, "#,##0")
  410.     Label8.Caption = Format$(BFree, "#,##0")
  411.     Label9.Caption = Format$(BSector, "#,##0")
  412.     Label10.Caption = Format$(BCluster, "#,##0")
  413. End Sub
  414. Sub File1_DblClick ()
  415.     Dim Stat As Integer
  416.     Dim FName As String
  417.     Dim FSiz As Long
  418.     Dim FAttr As Integer
  419.     Dim Ayear As Integer
  420.     Dim Amonth As Integer
  421.     Dim Aday As Integer
  422.     Dim Ahour As Integer
  423.     Dim Aminute As Integer
  424.     Dim Asecond As Integer
  425.     'Build the full file name
  426.     If (Right$(File1.Path, 1) = "\") Then
  427.         FName = File1.Path + File1.FileName
  428.     Else
  429.         FName = File1.Path + "\" + File1.FileName
  430.     End If
  431.     'Now call the Get routines
  432.     Stat = FileGetDateTime(FName, Ayear, Amonth, Aday, Ahour, Aminute, Asecond)
  433.     FSiz = FileGetBytes(FName)
  434.     FAttr = FileGetAttributes(FName)
  435.     'Now display the results
  436.     Text1.Text = Str$(Aday)
  437.     Text2.Text = Str$(Amonth)
  438.     Text3.Text = Str$(Ayear)
  439.     Text4.Text = Str$(Ahour)
  440.     Text5.Text = Str$(Aminute)
  441.     Text6.Text = Str$(Asecond)
  442.     Label18.Caption = Str$(FSiz)
  443.     'Extract attribute information
  444.     'See if file is read only
  445.     If (FAttr And A_RDONLY) Then
  446.         Check1.Value = 1
  447.     Else
  448.         Check1.Value = 0
  449.     End If
  450.     'See if file is hidden
  451.     If (FAttr And A_HIDDEN) Then
  452.         Check2.Value = 1
  453.     Else
  454.         Check2.Value = 0
  455.     End If
  456.     'See if file is a system file
  457.     If (FAttr And A_SYSTEM) Then
  458.         Check3.Value = 1
  459.     Else
  460.         Check3.Value = 0
  461.     End If
  462.     'See if archive bit is set
  463.     If (FAttr And A_ARCH) Then
  464.         Check4.Value = 1
  465.     Else
  466.         Check4.Value = 0
  467.     End If
  468. End Sub
  469. Sub Form_Load ()
  470.     Dim BTotal As Long
  471.     Dim BUsed As Long
  472.     Dim BFree As Long
  473.     Dim BSector As Long
  474.     Dim BCluster As Long
  475.     'Now, get all of the information
  476.     BTotal = DiskBytesTotal("")
  477.     BUsed = DiskBytesUsed("")
  478.     BFree = DiskBytesFree("")
  479.     BSector = DiskBytesSector("")
  480.     BCluster = DiskBytesCluster("")
  481.     'Now put information on form
  482.     Label6.Caption = Format$(BTotal, "#,##0")
  483.     Label7.Caption = Format$(BUsed, "#,##0")
  484.     Label8.Caption = Format$(BFree, "#,##0")
  485.     Label9.Caption = Format$(BSector, "#,##0")
  486.     Label10.Caption = Format$(BCluster, "#,##0")
  487. End Sub
  488.