密码登陆窗体
密码登陆窗体1代码Private Sub Command1_Click()
Static times As Integer
If Trim(Text1.Text) = "123456" Then
Label2.Caption = "欢迎进入本软件!"
Label2.ForeColor = vbBlue
Label2.FontSize = 20
Label2.FontName = "华文行楷"
Else
If times < 2 Then
Label2.Caption = "密码错误,你还有" + Trim(Str(2 - times)) + "次机会,请重新输入!"
Label2.ForeColor = vbRed
Label2.FontSize = 13
Label2.FontName = "华文行楷"
Text1.Text = ""
Text1.SetFocus
times = times + 1
Else
Label2.Caption = "非法用户,请退出!"
Label2.ForeColor = vbRed
Label2.FontSize = 20
Label2.FontName = "华文行楷"
Text1.Text = ""
Text1.Locked = True
End If
End If
If (Text1.Text = "123456") Then
Form1.Hide
Form2.Show
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Command3_Click()
Label2.Caption = "请在上面输入密码!"
Label2.ForeColor = vbBlue
Label2.FontSize = 20
Label2.FontName = "华文行楷"
Text1.Text = ""
End Sub
Private Sub Form_Load()
Text1.MaxLength = 6
Text1.PasswordChar = "*"
Label2.AutoSize = True
Text1.Text = ""
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 48 To 57, 8
Case Else
KeyAscii = 0
End Select
End Sub
密码登陆窗体2代码
Private Declare Function GetDiskFreeSpace Lib "kernel32" Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String, lpSectorsPerCluster As Long, lpBytesPerSector As Long, lpNumberOfFreeClusters As Long, lpTtoalNumberOfClusters As Long) As Long
Private Sub Command1_Click()
Dim a, b, c, d, free, total As Long
Dim disk As String
disk = Text1.Text
GetDiskFreeSpace disk, a, b, c, d
total = d * b * a / 1024 / 1024
free = c * a * b / 1024 / 1024
Label3.Caption = total & "MB"
Label4.Caption = free & "MB"
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Label4.Caption = ""
Label3.Caption = ""
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub Timer1_Timer()
Label6.Left = Label6.Left + 50
If Label6.Left >= Form1.Width Then
Label6.Left = -Label6.Width
End If
End Sub
密码为:123456
工程1.rar
(6.24 KB)