思考了一天了,也没有结果,大侠帮忙啊!
我运行到 MsgBox mFTP.GetLastErrorMessage & "检测信息-3"这一段的时候,提示:
200 type set to A
200 port command successful
550 the system cannot find the path specified
所有的设置及远程的设置都正确,这是怎么回事呢?烦请指点一下!
If txtIsCon.Text = "0 [ ip success ]" Then
Dim obj As clsDownload
Set obj = New clsDownload
Dim bRet As Boolean
Dim TDownloadSite As String
Dim tDownloadPath As String
Dim tDownloadFile As String
TDownloadSite = "http://www.popmoon.com/"
tDownloadPath = "word100/popsoft/"
tDownloadFile = "DemoUpdate.inf"
Screen.MousePointer = vbHourglass
bRet = obj.Get_File(TDownloadSite & tDownloadPath & tDownloadFile, App.Path & "/Updates/" & tDownloadFile)
If bRet = False Then Me.Caption = "Error downloading!"
Screen.MousePointer = vbDefault
Set obj = Nothing
Dim myDir, myPath, myFile
myPath = App.Path & "/Updates/"
myFile = "DemoUpdate.inf"
If Dir(myPath + myFile) = "" Then
MsgBox "获取信息失败,请重新尝试!", vbInformation
Else
CmdDownWinsock_Click
GetFileName
CmdChekInfor_Click
CmdReCopy_Click
MsgBox "获取信息成功!", vbInformation
End If
Else
MsgBox "升级服务器当前不可用,请稍候再试!", vbInformation
Exit Sub
End If
End Sub
Private Sub CmdDownWinsock_Click()
If txtIsCon.Text = "0 [ ip success ]" Then
Dim obj As clsDownload
Set obj = New clsDownload
Dim bRet As Boolean
Dim TDownloadSite As String
Dim tDownloadPath As String
Dim tDownloadFile As String
TDownloadSite = "http://www.popmoon.com/word100/popsoft/"
tDownloadFile = "Winsock.inf"
Screen.MousePointer = vbHourglass
bRet = obj.Get_File(TDownloadSite & tDownloadFile, App.Path & "/Updates/" & tDownloadFile)
If bRet = False Then Me.Caption = "Error downloading!"
Screen.MousePointer = vbDefault
Set obj = Nothing
Else
MsgBox "升级服务器当前不可用,请稍候再试!", vbInformation
Exit Sub
End If
End Sub
Private Sub CmdUpdate_Click()
Dim lTimer As Long
Dim strRemote As String
Dim strLocal As String
BeginTransfer = Timer
strRemote = Text4.Text & "/" & Text5.Text
strLocal = App.Path & "\" & Text5.Text
lTimer = Timer
Label3.Caption = "程序正在升级中..."
If Text6.Text = "Yes" Then
MsgBox "如果《新月单词通》正在运行,请将其关闭。", vbInformation,
End If
If mFTP.OpenConnection(Text3.Text, Trim(Infor1), Trim(Infor2)) Then
mFTP.SetFTPDirectory "/"
If Not mFTP.FTPDownloadFile(strLocal, strRemote) Then
Label3.Caption = "正在检测升级信息..."
MsgBox mFTP.GetLastErrorMessage & "下面将检测升级信息-3"Else
Label3.Caption = "恭喜您,软件升级成功!"
DoEvents
RunUpdate App.Path & "\" & Text5.Text
DoEvents
If Text6.Text = "Yes" Then
End
End If
End If
DoEvents
mFTP.CloseConnection
End If
End Sub
Private Sub Command3_Click()
End
End Sub
Public Sub mFTP_FileTransferProgress(lCurrentBytes As Long, lTotalBytes As Long)
On Error Resume Next
Dim j As Long
Dim j2 As Long
TransferRate = Format(Int(lCurrentBytes / (Timer - BeginTransfer)) / 1000, "####.00")
PB.Max = lTotalBytes
PB.Min = 0
j = PB.Value
j2 = PB.Value \ 1024
DoEvents
PB.Value = lCurrentBytes
DoEvents
PB.ToolTipText = PB.Value & " Bytes of " & PB.Max & " Bytes Transfered"
DoEvents
Label7.Caption = PB.Value \ 1024 & " KB of " & PB.Max \ 1024 & " KB Transfered"
DoEvents
Label9.Caption = Format$(CLng((j / PB.Max) * 100)) + "%"
DoEvents
Label10.Caption = Format(TransferRate, "##.#0#") & " Kbps"
Label11.Caption = ConvertTime(Int(((PB.Max - PB.Value) / 1024) / TransferRate))
If PB.Value = PB.Max Then
Label9.Caption = "100%"
End If
End Sub
Private Function GetPrivateProfileString(ByVal szSection As String, ByVal szEntry As Variant, ByVal szDefault As String, ByVal szFileName As String) As String
Dim szTmp As String
Dim nRet As Long
If (IsNull(szEntry)) Then
szTmp = String$(nBUFSIZEINIALL, 0)
nRet = OSGetPrivateProfileString(szSection, 0&, szDefault, szTmp, nBUFSIZEINIALL, szFileName)
Else
szTmp = String$(nBUFSIZEINI, 0)
nRet = OSGetPrivateProfileString(szSection, CStr(szEntry), szDefault, szTmp, nBUFSIZEINI, szFileName)
End If
GetPrivateProfileString = Left$(szTmp, nRet)
End Function
Private Function GetProfileString(ByVal szSection As String, ByVal szEntry As Variant, ByVal szDefault As String) As String
Dim szTmp As String
Dim nRet As Long
If (IsNull(szEntry)) Then
szTmp = String$(nBUFSIZEINIALL, 0)
nRet = OSGetProfileString(szSection, 0&, szDefault, szTmp, nBUFSIZEINIALL)
Else
szTmp = String$(nBUFSIZEINI, 0)
nRet = OSGetProfileString(szSection, CStr(szEntry), szDefault, szTmp, nBUFSIZEINI)
End If
GetProfileString = Left$(szTmp, nRet)
End Function
Private Sub CmdChekInfor_Click()
Dim lTimer As Long
Dim strRemote As String
Dim strLocal As String
Dim NewVer As String
Dim Oldver As String
Dim url As String
Dim AppDir As String
Dim YourVersion As String
Dim VersionDate As String
Dim FileSize As String
Dim WhatNew As String
Dim AppTitle As String
AppTitle = "新月单词通 - 在线升级"
NewVer = "none"
Oldver = "none"
AppDir = App.Path
YourVersion = TxtCurVersion.Text
strLocal = App.Path & "\Updates\DemoUpdate.inf"
lTimer = Timer
FilePathName = AppDir + "\Updates\DemoUpdate.inf"
NewVer = GetPrivateProfileString("Version", "Version", "", FilePathName)
NewVersion = NewVer
VersionDate = GetPrivateProfileString("Version", "VersionDate", "", FilePathName)
FileSize1 = GetPrivateProfileString("Version", "Filesize1", "", FilePathName)
FileSize2 = GetPrivateProfileString("Version", "Filesize2", "", FilePathName)
WhatNew = GetPrivateProfileString("Version", "Whatsnew", "", FilePathName)
Downloadsite = GetPrivateProfileString("Version", "DownloadSite", "", FilePathName)
DownloadPath = GetPrivateProfileString("Version", "DownloadPath", "", FilePathName)
DownloadFile = GetPrivateProfileString("Version", "DownloadFile", "", FilePathName)
CloseProgramBeforeUpdate = GetPrivateProfileString("Version", "CloseProgramBeforeUpdate", "", FilePathName)
DownloadIP = GetPrivateProfileString("Version", "DownloadIP", "", FilePathName)
Infor = GetPrivateProfileString("Version", "Infor", "", FilePathName)
If TxtCurVersion.Text >= NewVer Then
TxtUpdateVersion.Text = NewVer
TxtUpdateFileName = ""
TxtUpdateDate.Text = ""
TxtUpdateSize.Text = ""
TxtUpdateInfo.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Label3.Caption = "软件当前已是最新版本!"
Else
TxtUpdateVersion.Text = NewVer
TxtUpdateDate.Text = VersionDate
TxtUpdateFileName = DownloadFile
TxtUpdateSize.Text = FileSize1 & " " & FileSize2
TxtUpdateInfo.Text = WhatNew
Text3.Text = Downloadsite
Text4.Text = DownloadPath
Text5.Text = DownloadFile
Text6.Text = CloseProgramBeforeUpdate
Text1 = DownloadIP
UserInfor = Infor
Infor1 = Left(UserInfor, InStr(UserInfor, ";") - 1)
Infor2 = Right(UserInfor, (Len(UserInfor) - InStr(UserInfor, ";")))
CmdUpdate.Enabled = True
Label3.Caption = "软件当前可以升级"
End If
End Sub
Private Sub Form_Load()
'注册信息
'略
Dim intfile As Integer
Dim pass As String
intfile = FreeFile
Open App.Path & "\Version.ini" For Input As #intfile
Input #intfile, pass
TxtCurVersion.Text = pass
Close #intfile
DoEvents
Set mFTP = New cFTP
mFTP.SetModeActive
mFTP.SetTransferBinary
Dim IPfile As Integer
Dim IPpass As String
IPfile = FreeFile
Open "Updates\Winsock.inf" For Input As #IPfile
Input #IPfile, IPpass
TxtIP.Text = IPpass
Close #IPfile
DoEvents
Me.Picture = LoadPicture(App.Path & "\Files\UpdateMain.bmp")
Call SetAutoRgn(Me)
Me.Picture = LoadPicture(App.Path & "\Files\update.bmp")
Picture1.BackColor = RGB(250, 249, 241)
lbl.BackColor = RGB(250, 249, 241)
TxtCurVersion.BackColor = RGB(250, 249, 241)
Label3.BackColor = RGB(250, 249, 241)
Label7.BackColor = RGB(250, 249, 241)
Label9.BackColor = RGB(250, 249, 241)
Label10.BackColor = RGB(250, 249, 241)
Label11.BackColor = RGB(250, 249, 241)
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
ReleaseCapture
SendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&
End If
End Sub
Private Sub Timer1_Timer()
hDestDC = FrmUpdate.hDC
hSrcDC = Picture1.hDC
drawflag = drawbmpmode(bmpnum)
movestep = movestep + 2
If movestep > endmax Then
bmpnum = bmpnum + 1
If bmpnum >= bmpfilemax Then
bmpnum = 0
End If
movestep = 0
Picture1.Picture = LoadPicture(bmpfile(bmpnum))
End If
End Sub
Private Sub tmrIsCon_Timer()
If txtIsCon.Text = "0 [ ip success ]" Then
lbl.Caption = "已经连接到升级服务器..."
tmrIsCon.Interval = 10000
Dim bmpnum, movestep, xmax, ymax As Integer
Timer1.Enabled = True
bmpnum = 0
bmpfile(0) = App.Path & "\files\0001.bmp"
bmpfile(1) = App.Path & "\files\0002.bmp"
bmpfile(2) = App.Path & "\files\0003.bmp"
bmpfile(3) = App.Path & "\files\0004.bmp"
bmpfile(4) = App.Path & "\files\0005.bmp"
bmpfile(5) = App.Path & "\files\0006.bmp"
drawbmpmode(0) = 1
drawbmpmode(1) = 2
drawbmpmode(2) = 3
drawbmpmode(3) = 4
drawbmpmode(4) = 5
drawbmpmode(5) = 6
movestep = 0
xmax = FrmUpdate.ScaleWidth / 2
ymax = FrmUpdate.ScaleHeight / 2
kxy = ymax / xmax
Picture1.Picture = LoadPicture(bmpfile(bmpnum))
Timer1.Interval = 100
Else
lbl.Caption = "没有检测到服务器,请稍候重试..."
Timer1.Enabled = False
Picture1 = Picture2
End If
End Sub
Private Sub tmrPing_Timer()
Dim ECHO As ICMP_ECHO_REPLY
Dim pos As Integer
Call Ping(TxtIP, ECHO)
txtIsCon.Text = GetStatusCode(ECHO.status)
tmrPing.Interval = 10000
End Sub
补充:VB , 网络编程