登陆框的代码问题 清高手指教
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpbuffer As String, nSize As Long) As Long
Public OK As Boolean
Private Sub Form_Load()
Dim sBuffer As String
Dim lSize As Long
sBuffer = Space$(255)
lSize = Len(sBuffer)
Call GetUserName(sBuffer, lSize)
If lSize > 0 Then
txtUserName.Text = Left$(sBuffer, lSize)
Else
txtUserName.Text = vbNullString
End If
End Sub
Private Sub Cmd_Cancel_Click()
OK = False
Me.Hide
End Sub
Private Sub Cmd_OK_Click()
'ToDo: 创建测试密码是否正确
'检查正确密码
If txtPassword.Text = "" Then
OK = True
Me.Hide
Else
MsgBox "密码错误,再试一次!", , "登录"
txtPassword.SetFocus
txtPassword.SelStart = 0
txtPassword.SelLength = Len(txtPassword.Text)
End If
End Sub
Private Sub lblLabels_Click(Index As Integer)
End Sub
怎么提示有错误啊