欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件高级功能研发区 → 登录身份验证的窗体编写范例

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有6887人关注过本帖平板打印复制链接

主题:登录身份验证的窗体编写范例

帅哥哟,离线,有人找我吗?
admin
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:7302 积分:32559 威望:1000 精华:45 注册:2003/12/30 16:34:32
登录身份验证的窗体编写范例  发帖心情 Post By:2011/1/19 0:53:40 [只看该作者]

 

 

 

下载地址 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


 

[此贴子已经被作者于2011-1-19 9:22:38编辑过]

[本帖被加为精华]
 回到顶部