Inet问题,急!大家帮忙啊

gwzgonzoopera 2010-09-25 04:11:38
Private Function PutFtp(ByVal FileName As String, ByVal StrName As String) As Boolean
Dim StrU As String
StrU = "put " & FileName & " " & StrName
With Inet1
.URL = "ftp://192.168.5.39"
.UserName = "3gic"
.Password = "3gic5.39"
.Protocol = icFTP
.RequestTimeout = 600
Inet1.Execute , " " & StrU & " "

End With

End Function
这是代码,出现问题比较奇怪,当直接执行的时候,报错“正在执行上一请求”
但是手动调试的时候就没有问题了
...全文
59 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
赵4老师 2010-09-26
  • 打赏
  • 举报
回复
Dim ExeStr As String
Dim Done As Boolean
Private Sub cmd(cmdstr As String)
Do
If Inet1.StillExecuting = False Then Exit Do
Loop
ExeStr = cmdstr
Done = False
Debug.Print ExeStr; "="
Inet1.Execute , ExeStr
Do
DoEvents
If Done Then Exit Do
Loop
End Sub
Private Sub Inet1_StateChanged(ByVal State As Integer)
Dim intFile As Integer
Dim vtData() As Byte
Dim str As String
'On Error GoTo ISCerr
Debug.Print "State="; State,
Select Case State
Case 0
Debug.Print "icNone"
Case 1
Debug.Print "icHostResolvingHost"
Case 2
Debug.Print "icHostResolved"
Case 3
Debug.Print "icConnecting"
Case 4
Debug.Print "icConnected"
Case 5
Debug.Print "icRequesting"
Case 6
Debug.Print "icRequestSent"
Case 7
Debug.Print "icReceivingResponse"
Case 8
Debug.Print "icResponseReceived"
If Left(ExeStr, 2) = "CD" Then Done = True
Case 9
Debug.Print "icDisconnecting"
Case 10
Debug.Print "icDisconnected"
Done = True
Case 11
Debug.Print "icError of [" + ExeStr + "]="; Inet1.ResponseInfo
Done = True
Case 12
Debug.Print "icResponseCompleted----------------"
Do
str = Inet1.GetChunk(1024, icString)
If LenB(str) = 0 Then Exit Do
Debug.Print str
Loop
Done = True
End Select
Exit Sub
ISCerr:
Resume Next
End Sub
adnim 2010-09-25
  • 打赏
  • 举报
回复
1.获取Inet的状态。根据状态等上次执行完毕了才开始下一次执行。Inet应该有表示状态的属性吧?
2.每次调用Inet时强行初始化Inet的状态。关闭上次的链接。
gwzgonzoopera 2010-09-25
  • 打赏
  • 举报
回复
应该怎么解决这个问题呢
jhone99 2010-09-25
  • 打赏
  • 举报
回复
并不矛盾,直接执行的时候快,上一个没有完,调试慢,就看不到问题了

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧