📄 windowbt.bas
字号:
Attribute VB_Name = "WindowBT"
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function GetForegroundWindow Lib "user32" () As Long
Public Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Public Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Public JubingM, JubingQ As Long
Public BiaotiIn, BiaotiOut, BTemp As String
Public BTCD As Long
Public X, ZC As Integer
Public Sub CapJB() '取句柄
JubingQ = GetForegroundWindow()
End Sub
Public Sub CapBTCD() '取标题长度
BTCD = GetWindowTextLength(JubingQ)
End Sub
'????值得研究的回调函数
Function CapBT(ByVal hwnd As Long, ByVal parma As Long) As Long '取标题
Dim astr As String * 256
GetWindowText hwnd, astr, Len(astr)
X = InStr(astr, Chr(0))
BTemp = Left$(astr, X - 1)
CapBT = True
End Function
'改写标题
Public Sub rewriteBT()
BiaotiOut = BiaotiIn + " " + CStr(Now)
SetWindowText JubingQ, BiaotiOut
End Sub
'还原标题
Public Sub Huanyuan()
cd = GetWindowTextLength(JubingM)
If cd <> 0 Then
SetWindowText JubingM, BiaotiIn
End If
End Sub
Public Sub gengxin()
CapBTCD
If BTCD > 0 Then
CapBT JubingQ, 0
sss = Left(BTemp, ZC - 1)
cdcd = Len(CStr(Now))
If StrComp(sss, BiaotiIn) = 0 And ZC = X - 1 - cdcd Then
rewriteBT
Else
BiaotiIn = BTemp
rewriteBT
ZC = X
End If
End If
End Sub
Public Sub gaixie()
Huanyuan
CapBTCD
If BTCD > 0 Then
CapBT JubingQ, 0
If BTemp = "10Moons TV Baby Capture" Or BTemp = "Program Manager" Or BTemp = "「开始」菜单" Then
Else
BiaotiIn = BTemp
rewriteBT
ZC = X
JubingM = JubingQ
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -