可以在服务器端放2个文件,一个假如是Updateini,还有一个就是你的程序,假如是,在本地还要有一个文件,存放设置,假如是configini
Updateini:
[update]
new=101
configini:
[config]
ver=100
代码:
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
Private Sub Form_Load()
r = URLDownloadToFile(0,"", AppPath & "\Update\uini", 0, 0)
'下载好文件后,就开始读ini了
Dim ret As Long
Dim nowv, newv As String
nowv = Space$(1000) '事先定义读取值的字串宽度
'读出新版本和旧版本
ret = GetPrivateProfileString("update", "new", "", newv, 1000, AppPath & "\Update\Updateini")
ret = GetPrivateProfileString("config", "ver", "", nowv, 1000, AppPath & "\Update\Updateini")
'如果新版本和旧版本不同,则开始下载新版本
If nowv <> newv Then
r = URLDownloadToFile(0,"", AppPath & "\Update\1exe", 0, 0)
End Sub
写了这么多,楼主是不是给点分,多给点
一楼说文件类型,显然是没有看题
看到二楼说的,我无语~~
以上就是关于如何用VB制作在线升级全部的内容,包括:如何用VB制作在线升级、、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)