Dim linked As Boolean
Dim thestep As Integer
Dim password As String
Dim userid As String
Dim pop3 As StringPrivate Sub cmdbeg_Click()
Dim i
On Error GoTo dothat
pop3 = txtip.Text
txton = "正连接"
'ip
Winsock1.RemoteHost = pop3
'端口号
Winsock1.RemotePort = 110
Winsock1.Connect
'可能陷入四循环
txton = 已连接
Do While Winsock1.State <> 7
i = DoEvents
Loop
GoTo dogoon
Exit Sub
dothat:
MsgBox "没连接"
txton = "连接错误"
dogoon:
linked = True
End Sub
Private Sub Form_Load()
linked = False
txton = "未登陆到服务器"
thestep = 0
End SubPrivate Sub Timer1_Timer()
Dim i
If Not lincked Then
On Error GoTo dothat
pop3 = txtip
txton = "正在连接"
Winsock1.RemoteHost = "192.168.0.2"
Winsock1.RemotePort = 110
Winsock1.Connect
Do While Winsock1.State <> 7
i = DoEvents()
Loop
GoTo dogoon
dothat:
MsgBox "错误"
txton = "连接错误"
dogoon:
linked = True
End If
End SubPrivate Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim i
Dim s As String
Dim strs As String
Winsock1.GetData s
MsgBox s
text2 = s
' MsgBox thestep
Select Case thestep
Case 0
If Left(text2, 3) = "+OK" Then
userid = txtuser
Winsock1.SendData "USER" & userid & vbCrLf '& Chr$(10) & Chr$(13)
thestep = thestep + 1 '& vbCrLf
txton = "发送userid...."
Else
Winsock1.Close
Do While Winsock1.State <> 0
i = DoEvents()
Loop
MsgBox "登不上..."
linked = False
thestep = 0
End If
Case 1
strs = s
If Left(strs, 3) = "+OK" Then
password = txtpsw
s = "PASS" & password & vbCrLf ' & Chr$(10) & Chr$(13)
Winsock1.SendData "PASS" & password & vbCrLf
thestep = thestep + 1
txton = "发送password......"
Else
Winsock1.Close
Do While Winsock1.State <> 0
i = DoEvents()
Loop
MsgBox "账户不对..."
linked = False
txton = "账户错误"
thestep = 0
End If
Case 2
strs = s
Dim n1 As Integer
Dim n2 As Integer
Dim num As Integer
If Left(s, 3) = "+OK" Then
n1 = InStr(s, "has")
n2 = Len(Mid(s, InStr(s, "message")))
s = Mid(strs, n1 + 3, Len(s) - n1 - 3 - n2)
s = Trim(s)
num = s
txton = "关闭连接"
If num > 0 Then
txton = "您有" & s & "封信"
End If
Winsock1.Close
Do While Winsock1.State <> 0
Loop
i = DoEvents()
linked = False
thestep = 0
Else
Winsock1.Close
Do While Winsock1.State <> 0
i = DoEvents()
Loop
'MsgBox num
MsgBox "用户口令不对"
linked = False
thestep = 0
txton = "口令错误"
End If
End Select
End Sub
总是提示口令错误,我实在找不出错在哪里!!登录的user&pass均正确!!!
Dim thestep As Integer
Dim password As String
Dim userid As String
Dim pop3 As StringPrivate Sub cmdbeg_Click()
Dim i
On Error GoTo dothat
pop3 = txtip.Text
txton = "正连接"
'ip
Winsock1.RemoteHost = pop3
'端口号
Winsock1.RemotePort = 110
Winsock1.Connect
'可能陷入四循环
txton = 已连接
Do While Winsock1.State <> 7
i = DoEvents
Loop
GoTo dogoon
Exit Sub
dothat:
MsgBox "没连接"
txton = "连接错误"
dogoon:
linked = True
End Sub
Private Sub Form_Load()
linked = False
txton = "未登陆到服务器"
thestep = 0
End SubPrivate Sub Timer1_Timer()
Dim i
If Not lincked Then
On Error GoTo dothat
pop3 = txtip
txton = "正在连接"
Winsock1.RemoteHost = "192.168.0.2"
Winsock1.RemotePort = 110
Winsock1.Connect
Do While Winsock1.State <> 7
i = DoEvents()
Loop
GoTo dogoon
dothat:
MsgBox "错误"
txton = "连接错误"
dogoon:
linked = True
End If
End SubPrivate Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim i
Dim s As String
Dim strs As String
Winsock1.GetData s
MsgBox s
text2 = s
' MsgBox thestep
Select Case thestep
Case 0
If Left(text2, 3) = "+OK" Then
userid = txtuser
Winsock1.SendData "USER" & userid & vbCrLf '& Chr$(10) & Chr$(13)
thestep = thestep + 1 '& vbCrLf
txton = "发送userid...."
Else
Winsock1.Close
Do While Winsock1.State <> 0
i = DoEvents()
Loop
MsgBox "登不上..."
linked = False
thestep = 0
End If
Case 1
strs = s
If Left(strs, 3) = "+OK" Then
password = txtpsw
s = "PASS" & password & vbCrLf ' & Chr$(10) & Chr$(13)
Winsock1.SendData "PASS" & password & vbCrLf
thestep = thestep + 1
txton = "发送password......"
Else
Winsock1.Close
Do While Winsock1.State <> 0
i = DoEvents()
Loop
MsgBox "账户不对..."
linked = False
txton = "账户错误"
thestep = 0
End If
Case 2
strs = s
Dim n1 As Integer
Dim n2 As Integer
Dim num As Integer
If Left(s, 3) = "+OK" Then
n1 = InStr(s, "has")
n2 = Len(Mid(s, InStr(s, "message")))
s = Mid(strs, n1 + 3, Len(s) - n1 - 3 - n2)
s = Trim(s)
num = s
txton = "关闭连接"
If num > 0 Then
txton = "您有" & s & "封信"
End If
Winsock1.Close
Do While Winsock1.State <> 0
Loop
i = DoEvents()
linked = False
thestep = 0
Else
Winsock1.Close
Do While Winsock1.State <> 0
i = DoEvents()
Loop
'MsgBox num
MsgBox "用户口令不对"
linked = False
thestep = 0
txton = "口令错误"
End If
End Select
End Sub
总是提示口令错误,我实在找不出错在哪里!!登录的user&pass均正确!!!
解决方案 »
- 留言框与按钮代码合并后通不过,不知何故?请指正
- ACCESS数据库怎样被几个用户访问呢
- 问题出在哪里?setParameterInfo???
- ado data 控件的问题,望解答,谢!
- rs.Open "SELECT * FROM 表1 WHERE 字段1= '" & Combo1(1).Text & " AND 字段2= '" & Combo1(2).Text & "'",db, adOpenStatic, adLockOpt
- 怎样知道窗口是否已经加载完成
- 如何将mshflexgrid内选定的一列数据填充到数组内?
- 请问一下怎么使用sql 的count语句,不知道这样对不对,谢谢!
- 谁有串口通讯的DLL 送我一份谢谢
- 如何欺骗所有的应用程序,屏幕比实际小了,详细请看......
- 初学vb请教问题?
- 本人想做一个电子邮件收发系统,需要一个功能比较齐全的作为参考.哪位高手愿意
user账号 (错)