home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form ChgVname
- BackColor = &H00C0C0C0&
- BorderStyle = 1 'Fixed Single
- Caption = "Change Volume Name"
- ClientHeight = 2400
- ClientLeft = 1095
- ClientTop = 1485
- ClientWidth = 3615
- ControlBox = 0 'False
- Height = 2805
- Left = 1035
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 2400
- ScaleWidth = 3615
- Top = 1140
- Width = 3735
- Begin TextBox Text1
- Height = 285
- Left = 240
- MaxLength = 11
- TabIndex = 0
- Text = "Text1"
- Top = 1200
- Width = 3135
- End
- Begin DriveListBox Drive1
- Height = 315
- Left = 240
- TabIndex = 3
- Top = 240
- Width = 3135
- End
- Begin CommandButton CmdOkay
- BackColor = &H00C0C0C0&
- Cancel = -1 'True
- Caption = "O &K A Y"
- Height = 375
- Left = 1800
- TabIndex = 2
- Top = 1800
- Width = 1575
- End
- Begin CommandButton CmdChgName
- BackColor = &H00C0C0C0&
- Caption = "Change &Name"
- Default = -1 'True
- Height = 375
- Left = 240
- TabIndex = 1
- Top = 1800
- Width = 1575
- End
- Dim VolName As String
- Sub CmdChgName_Click ()
- DriveLabel$ = Left$(UCase$(Drive1.Drive), 2)
- If IsDriveLocal(DriveLabel$) = False Then
- MsgBox "Can NOT format a network drive!", 48, "Rename Volume"
- Exit Sub
- End If
- Screen.MousePointer = 11
- NewVolName$ = Text1.Text
- If Len(NewVolName$) > 8 Then
- x% = Len(NewVolName$)
- TempName = Left$(NewVolName$, 8) + "." + Right$(NewVolName$, x% - 8)
- NewVolName$ = TempName
- End If
- If NewVolName$ = "No Label" Then NewVolName$ = ""
- NowDrive$ = UCase$(Left$(Drive1.Drive, 1))
- worked% = SetVolName(NowDrive$, NewVolName$)
- Screen.MousePointer = 0
- If worked% = False And NewVolName$ <> "" Then
- MsgBox "Unable to rename volume!", 16, "Volume Rename Error"
- FormPassString = "Failed"
- Exit Sub
- End If
- FormPassString = "NewVol"
- Unload Me
- End Sub
- Sub CmdOkay_Click ()
- FormPassString = "Okay"
- Unload Me
- End Sub
- Sub Drive1_Change ()
- Screen.MousePointer = 11
- DriveLabel$ = UCase$(Left$(Drive1.Drive, 1))
- Screen.MousePointer = 0
- If GetDriveStatus(DriveLabel$, "ready") = 0 Then
- MsgBox "Unavailable drive!", 16, "Drive Error " + DriveLabel$ + ":"
- ReturnString$ = Space$(10)
- GetDefaultDrive ReturnString$
- Drive1.Drive = TrimAtNull(ReturnString$)
- DriveLabel$ = UCase$(Left$(Drive1.Drive, 1))
- End If
- VolName = GetVolName(DriveLabel$)
- Text1.Text = VolName$
- Text1.SetFocus
- End Sub
- Sub Form_Load ()
- FormCenterForm Me, DemoMain
- DriveLabel$ = Left$(UCase$(Drive1.Drive), 2)
- VolName = GetVolName(DriveLabel$)
- Text1.Text = VolName$
- Screen.MousePointer = 0
- End Sub
- Sub Form_Paint ()
- DoForm3D Me, "raised", 2, 0
- DoForm3D Me, "sunken", 2, 2
- DoControl3D Drive1, "sunken", 1
- DoControl3D Text1, "sunken", 1
- End Sub
- Sub Text1_GotFocus ()
- Text1.SelStart = 0
- Text1.SelLength = Len(Text1.Text)
- End Sub
- Sub Text1_KeyPress (KeyAscii As Integer)
- Char = Chr(KeyAscii)
- KeyAscii = Asc(UCase(Char))
- If Char = Chr$(8) Then Exit Sub
- If KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Then Exit Sub
- If KeyAscii = Asc(" ") Then Exit Sub
- If KeyAscii = Asc("*") Then Exit Sub
- If KeyAscii = Asc("$") Then Exit Sub
- If KeyAscii = Asc("!") Then Exit Sub
- If KeyAscii < Asc("A") Or KeyAscii > Asc("Z") Then
- KeyAscii = 0
- Exit Sub
- End If
- End Sub
-