下载地址 http://www.weistock.com/download/Logon.frm
导入方法:
窗体全部代码如下
LoginOk = 0 '0未登录 1登录成功
Sub Logon_Load()
Logon_OptionButton_Server1.Value = true
Logon_TextBox_UserName.Text = Document.GetPrivateProfileString("MyID", "LogName", "", "C:\HengFuSet.ini")
End Sub
Sub APPLICATION_VBAStart()
logon.Show'显示登录窗口
End Sub
Sub Logon_CommandButtonOK_Click()
Dim Server
Dim Port
Dim UserName
Dim Password
If Logon_OptionButton_Server1.Value = true Then
Server = "192.168.1.88"
Port = 55106
End if
UserName = Logon_TextBox_UserName.Text
Password = Logon_TextBox_Password.Text
Result = NetWork.UserValidate(Server,Port,UserName,Password) '至金钻版服务器验证用户身份
' Result = 1
if Result = 0 Then
MsgBox "服务器连接失败,请确认网络连接是否正常"
End if
if Result = 1 then
'登录成功
Logon.EndForm
checkoutdenglu=1
LoginOk = 1
End if
if result = 2 then
MsgBox "用户名密码无效"
End if
if result = 3 then
MsgBox "用户名重复登录"
End if
if result = 4 then
MsgBox "用户名已过期"
End if
if result = 5 then
MsgBox "服务器已满"
End if
call Document.WritePrivateProfileString("MyID", "LogName", Logon_TextBox_UserName.Text, "C:\HengFuSet.ini")
End Sub
Sub Logon_CommandButton_Cancel_Click()
Logon.EndForm
End Sub