VB高手进来看一下!VB设计一个游戏更新程序

我用VB做了一个网络游戏更新程序。原理是从一个FTP把游戏复制过来。但不知道在VB中用哪个函数可以实现这样的效果?
最新回答
萌姐姐不萌

2024-10-17 08:01:17

Public Function ConnectFTP(Optional ByVal vsFTPIPAdress As String, Optional vsUid As String = "", _
Optional vsPwd As String = "", Optional vsPort As String = "21") As Boolean
Dim site As FtpInfo
ConnectFTP = False
site.FtpIP = vsFTPIPAdress
site.UID = vsUid
site.PWD = vsPwd '调用格式检查,并将FTP信息保存到本地变量
If Len(site.FtpIP) = 0 Then
Err.Raise vbObjectError + 1, "ConnectFTP", "No IP Address!"
End If
'打开会话
mlOpenHandle = InternetOpen(scUserAgent, INTERNET_OPEN_TYPE_DIRECT, vbNullString, _
vbNullString, 2)
If mlOpenHandle = 0 Then
ErrorOut Err.LastDllError, "InternetOpen"
Exit Function
End If
'连接FTP服务器
Dim INTERNET_FLAG As Long
'If gbFtpCache Then
INTERNET_FLAG = INTERNET_FLAG_DONT_CACHE
'Else
' INTERNET_FLAG = INTERNET_FLAG_OFFLINE
'End If
mlConnectionHandle = InternetConnect(mlOpenHandle, site.FtpIP, vsPort, _
site.UID, site.PWD, INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, INTERNET_FLAG) 'xram
If mlConnectionHandle = 0 Then
mbActiveSession = False
Exit Function
Else
mbActiveSession = True
End If
ConnectFTP = True
End Function
独白

2024-10-17 08:03:22

你最好别用VB做了,即使有这种函数,速度也会慢得惊人。