更新

340 字
2 分钟
更新

更新#

Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Sub 获取标签名(control As IRibbonControl, ByRef returnedVal)
returnedVal = "报告小帮手 V2.6"
End Sub
Sub 获取标签日期(control As IRibbonControl, ByRef returnedVal)
returnedVal = "20220814更新"
End Sub
Sub 签名(control As IRibbonControl, ByRef returnedVal)
returnedVal = "公众号:茶瓜子的休闲馆"
End Sub
Sub 检查更新(control As IRibbonControl)
本地 = Val(ThisVersion)
最新 = Val(Getver)
If 本地 <> 最新 Then
y = MsgBox("存在新版本,是否进入主页查看最新版?", vbYesNo)
If y = 6 Then
OpenWeb
End If
Else
MsgBox "当前版本为最新版"
End If
End Sub
Public Function ThisVersion()
ThisVersion = "2.6"
End Function
Public Function Getver()
Dim Json As Object
URL = "http://api.gzaudit.com/xbs/wd/"
res = GetData(URL, "UTF-8")
Set Json = JsonConverter.ParseJson(res)
Getver = Json("版本")
End Function
Sub OpenWeb()
ShellExecute 0&, vbNullString, "www.gzaudit.com", vbNullString, vbNullString, vbNormalFocus
End Sub
Function GetData(StrUrl, CodePageX)
Dim oHtml As Object
Set oHtml = VBA.CreateObject("WinHttp.WinHttpRequest.5.1")
Dim sUrl As String
sUrl = StrUrl
Dim sCharset As String
sCharset = CodePageX
With oHtml
.Open "GET", sUrl, False
.setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
.Send
'获取返回的字节数组
bResult = .ResponseBody
'按照指定的字符编码显示
sResult = BytesToStr(bResult, CodePageX)
'Debug.Print sResult
End With
GetData = sResult
Set oHtml = Nothing
End Function
Public Function BytesToStr(strBody, CodeBase)
Dim objStream
Set objStream = CreateObject("Adodb.Stream")
With objStream
.Type = 1
.Mode = 3
.Open
.Write strBody
.Position = 0
.Type = 2
.Charset = CodeBase '"GB2312" '
BytesToStr = .ReadText
.Close
End With
Set objStream = Nothing
End Function

支持与分享

如果这篇文章对你有帮助,欢迎分享给更多人或打赏支持!

打赏

评论区

Profile Image of the Author
richfan
Hello, I'm richfan.
公告
欢迎来到我的博客!这是一则示例公告。
音乐
封面

音乐

暂未播放

0:000:00
暂无歌词
分类
标签
站点统计
文章
779
分类
8
标签
138
总字数
3,267,679
运行时长
0
最后活动
0 天前
站点信息
构建平台
Cloudflare Pages
博客版本
Firefly v6.13.5
文章许可
CC BY-NC-SA 4.0

文章目录