7,763
社区成员
发帖
与我相关
我的任务
分享
'判断制定窗口是否在最前端
Function header(frmName As String) As Boolean
hWnd1 = GetForegroundWindow() '得到活动窗口的句柄
if getCaption(hWnd1) = frmName then
header = True
else
header = False
End If
End Sub
'根据窗口句柄得到该窗口的标题
Function getCaption(hWnd As Long)
Dim hWndlength As Long, hWndTitle As String, A As Long
hWndlength = GetWindowTextLength(hWnd)
hWndTitle = String$(hWndlength, 0)
A = GetWindowText(hWnd, hWndTitle, (hWndlength + 1))
getCaption = hWndTitle
End Function