home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{2E0F38D3-1E76-11D3-AC42-00C0DFE9A30F}#4.0#0"; "BW5DF11S.OCX"
- Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.2#0"; "COMCTL32.OCX"
- Begin VB.Form Form1
- Caption = "BW Disk Format OCX - Sample project"
- ClientHeight = 5145
- ClientLeft = 165
- ClientTop = 450
- ClientWidth = 8025
- LinkTopic = "Form1"
- ScaleHeight = 5145
- ScaleWidth = 8025
- StartUpPosition = 2 'CenterScreen
- Begin ComctlLib.ProgressBar ProgressBar1
- Height = 135
- Left = 120
- TabIndex = 31
- Top = 4920
- Width = 7815
- _ExtentX = 13785
- _ExtentY = 238
- _Version = 327682
- Appearance = 1
- End
- Begin DiskFormatOCX.DiskFormat DiskFormat1
- Left = 5040
- Top = 1200
- _ExtentX = 979
- _ExtentY = 979
- End
- Begin VB.TextBox Text3
- Height = 285
- Left = 6000
- TabIndex = 26
- Top = 2130
- Width = 1935
- End
- Begin VB.CommandButton Command6
- Caption = "Set label"
- Height = 375
- Left = 3240
- TabIndex = 25
- Top = 2040
- Width = 1455
- End
- Begin VB.CommandButton Command5
- Caption = "Get label"
- Height = 375
- Left = 3240
- TabIndex = 24
- Top = 1560
- Width = 1455
- End
- Begin VB.ComboBox Combo2
- Height = 315
- ItemData = "Sample.frx":0000
- Left = 6000
- List = "Sample.frx":001C
- TabIndex = 23
- Text = "1440"
- Top = 480
- Width = 1935
- End
- Begin VB.ComboBox Combo1
- Height = 315
- ItemData = "Sample.frx":0048
- Left = 6000
- List = "Sample.frx":006A
- TabIndex = 21
- Text = "Full"
- Top = 120
- Width = 1935
- End
- Begin VB.CommandButton Command4
- Caption = "Disk status"
- Height = 375
- Left = 3240
- TabIndex = 19
- Top = 1080
- Width = 1455
- End
- Begin VB.CommandButton Command3
- Caption = "Cancel Format"
- Height = 375
- Left = 3240
- TabIndex = 16
- Top = 600
- Width = 1455
- End
- Begin VB.CommandButton Command2
- Caption = "Format Disk"
- Height = 375
- Left = 3240
- TabIndex = 15
- Top = 120
- Width = 1455
- End
- Begin VB.TextBox Text1
- Height = 285
- Left = 2160
- TabIndex = 2
- Text = "a:\"
- Top = 600
- Width = 615
- End
- Begin VB.CommandButton Command1
- Caption = "Get disk information"
- Height = 375
- Left = 240
- TabIndex = 0
- Top = 120
- Width = 2535
- End
- Begin VB.Label Label20
- Height = 255
- Left = 360
- TabIndex = 30
- Top = 3360
- Width = 7695
- End
- Begin VB.Label Label10
- Height = 255
- Left = 1680
- TabIndex = 29
- Top = 1080
- Width = 1815
- End
- Begin VB.Label Label8
- Caption = " Drive type :"
- Height = 255
- Left = 600
- TabIndex = 28
- Top = 1080
- Width = 975
- End
- Begin VB.Label Label1
- Caption = "Label :"
- Height = 255
- Left = 5400
- TabIndex = 27
- Top = 2160
- Width = 495
- End
- Begin VB.Label Label22
- Caption = "Disk size : "
- Height = 255
- Left = 5160
- TabIndex = 22
- Top = 480
- Width = 735
- End
- Begin VB.Label Label21
- Caption = "Format method :"
- Height = 255
- Left = 4800
- TabIndex = 20
- Top = 120
- Width = 1335
- End
- Begin VB.Label Label19
- Height = 255
- Left = 360
- TabIndex = 18
- Top = 4080
- Width = 7695
- End
- Begin VB.Label Label18
- Height = 255
- Left = 360
- TabIndex = 17
- Top = 3720
- Width = 7575
- End
- Begin VB.Label Label17
- Caption = " File system :"
- Height = 255
- Left = 600
- TabIndex = 14
- Top = 2520
- Width = 975
- End
- Begin VB.Label Label15
- Caption = "Used space :"
- Height = 255
- Left = 600
- TabIndex = 13
- Top = 2280
- Width = 1095
- End
- Begin VB.Label Label14
- Caption = " Free space :"
- Height = 255
- Left = 600
- TabIndex = 12
- Top = 2040
- Width = 975
- End
- Begin VB.Label Label13
- Caption = "Total space :"
- Height = 255
- Left = 600
- TabIndex = 1
- Top = 1800
- Width = 975
- End
- Begin VB.Label Label12
- Caption = "Volume number :"
- Height = 255
- Left = 360
- TabIndex = 11
- Top = 1560
- Width = 1215
- End
- Begin VB.Label Label11
- Caption = "Volume name :"
- Height = 255
- Left = 480
- TabIndex = 10
- Top = 1320
- Width = 1095
- End
- Begin VB.Label Label9
- Height = 255
- Left = 1680
- TabIndex = 9
- Top = 2520
- Width = 1095
- End
- Begin VB.Label Label7
- Height = 255
- Left = 1680
- TabIndex = 8
- Top = 2280
- Width = 1575
- End
- Begin VB.Label Label5
- Height = 255
- Left = 1680
- TabIndex = 7
- Top = 2040
- Width = 1575
- End
- Begin VB.Label Label4
- Height = 255
- Left = 1680
- TabIndex = 6
- Top = 1800
- Width = 1455
- End
- Begin VB.Label Label3
- Height = 255
- Left = 1680
- TabIndex = 5
- Top = 1560
- Width = 1455
- End
- Begin VB.Label Label2
- Height = 255
- Left = 1680
- TabIndex = 4
- Top = 1320
- Width = 1575
- End
- Begin VB.Label Label6
- Caption = "Type the drive , ex: a:\"
- Height = 255
- Left = 240
- TabIndex = 3
- Top = 600
- Width = 1815
- End
- Begin VB.Menu about
- Caption = "About"
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub about_Click()
- DiskFormat1.About
- End Sub
- Private Sub DiskFormat1_BadSectorReport(BadSectorReportDescription As String)
- Label20.Caption = "Bad sector report : " & BadSectorReportDescription
- End Sub
- Private Sub DiskFormat1_Finished(ReturnCode As Long, ReturnCodeDescription As String)
- Label18.Caption = "Finished - return information : " & ReturnCode & " : " & ReturnCodeDescription
- Dim TotalSpace As Long
- Dim UsedSpace As Long
- Dim FreeSpace As Long
- Dim FileSystem As String
- Dim VolumeName As String
- Dim VolumeNumber As Long
- Dim Drivetype As String
- Dim ret As Boolean
- ret = DiskFormat1.GetDriveInfos(Text1.Text, FileSystem, VolumeName, VolumeNumber, Drivetype, TotalSpace, FreeSpace, UsedSpace)
- Label2.Caption = VolumeName
- Label3.Caption = Hex(VolumeNumber) ' It will represent the volume number in the same way that you see when using the Dir command
- Label4.Caption = TotalSpace
- Label5.Caption = FreeSpace
- Label7.Caption = UsedSpace
- Label9.Caption = FileSystem
- Label10.Caption = Drivetype
- End Sub
- Private Sub DiskFormat1_Progress(ProgressValue As Long)
- 'This event will be raised in any update of the progress of the format function
- 'And it will represent perfectly the exact point of the format execution
- Label20.Caption = ""
- On Error Resume Next
- ProgressBar1.Value = ProgressValue
- End Sub
- Private Sub DiskFormat1_Status(OCXStatusLong As Long, OCXStatusString As String)
- 'This event will show what the OCX is doing at any point
- Label19.Caption = OCXStatusString
- End Sub
- Private Sub Command1_Click()
- Dim TotalSpace As Long
- Dim UsedSpace As Long
- Dim FreeSpace As Long
- Dim FileSystem As String
- Dim VolumeName As String
- Dim VolumeNumber As Long
- Dim Drivetype As String
- Dim ret As Boolean
- ret = DiskFormat1.GetDriveInfos(Text1.Text, FileSystem, VolumeName, VolumeNumber, Drivetype, TotalSpace, FreeSpace, UsedSpace)
- Label2.Caption = VolumeName
- Label3.Caption = Hex(VolumeNumber) ' it will represent the volume number in the same way you see when using the Dir command
- Label4.Caption = TotalSpace
- Label5.Caption = FreeSpace
- Label7.Caption = UsedSpace
- Label9.Caption = FileSystem
- Label10.Caption = Drivetype
- End Sub
- Private Sub Command2_Click()
- Label18.Caption = ""
- Dim Disk As String 'The disk that you want to format
- Disk = Text1.Text
- DiskFormat1.FormatDisk Disk, Combo1.Text, Combo2.Text
- End Sub
- Private Sub Command3_Click()
- 'It will cancel the format function , and it will return the control to the system
- DiskFormat1.CancelFormat
- End Sub
- Private Sub Command4_Click()
- Label19.Caption = ""
- Form1.Refresh
- Dim ric As Long
- ric = DiskFormat1.GetDiskStatus(Text1.Text)
- Select Case ric
- Case 0
- Label19.Caption = "The disk isnot in the drive"
- Case 1
- Label19.Caption = "Disk ready to be used"
- Case 2
- Label19.Caption = "The disk isnot formated"
- Case 3
- Label19.Caption = "The disk is write protected"
- Case -1
- Label19.Caption = "The drive isnot available"
- Case Else
- Label19.Caption = "Error trying to identify the type of drive"
- End Select
- End Sub
- Private Sub Command5_Click()
- Dim TotalSpace As Long
- Dim UsedSpace As Long
- Dim FreeSpace As Long
- Dim FileSystem As String
- Dim VolumeName As String
- Dim VolumeNumber As Long
- Dim Drivetype As String
- Dim ret As Boolean
- ret = DiskFormat1.GetDriveInfos(Text1.Text, FileSystem, VolumeName, VolumeNumber, Drivetype, TotalSpace, FreeSpace, UsedSpace)
- Text3.Text = VolumeName
- End Sub
- Private Sub Command6_Click()
- If Not DiskFormat1.SetVolumeLabel(Text1.Text, Text3.Text) Then
- MsgBox "Unable to set the new label in the drive " & Text1.Text
- End If
- End Sub
-