vb FindWindowEx问题
PublicSubShowhWnd(strTitleAsString,ShowAsBoolean)DimhFirstAsLong,hNextAsLonghFirst=Fi...
Public Sub ShowhWnd(strTitle As String, Show As Boolean)
Dim hFirst As Long, hNext As Long
hFirst = FindWindow(0&, strTitle)
If hFirst = 0 Then Exit Sub
If Show = True Then
ShowWindowAsync hFirst, SW_SHOW
Else
ShowWindowAsync hFirst, SW_HIDE
End If
hNext = hFirst
Do
hNext = FindWindowEx(0&, hFirst, 0&, strTitle)
If hNext = 0 Then Exit Do
If Show = True Then
ShowWindowAsync hNext, SW_SHOW
Else
ShowWindowAsync hNext, SW_HIDE
End If
Loop
End Sub
'为什么只能找到一个窗体隐藏啊?
'我要找所有的符合条件窗体隐藏 展开
Dim hFirst As Long, hNext As Long
hFirst = FindWindow(0&, strTitle)
If hFirst = 0 Then Exit Sub
If Show = True Then
ShowWindowAsync hFirst, SW_SHOW
Else
ShowWindowAsync hFirst, SW_HIDE
End If
hNext = hFirst
Do
hNext = FindWindowEx(0&, hFirst, 0&, strTitle)
If hNext = 0 Then Exit Do
If Show = True Then
ShowWindowAsync hNext, SW_SHOW
Else
ShowWindowAsync hNext, SW_HIDE
End If
Loop
End Sub
'为什么只能找到一个窗体隐藏啊?
'我要找所有的符合条件窗体隐藏 展开
1个回答
展开全部
Public Sub ShowhWnd(strTitle As String, Show As Boolean)
Dim hFirst As Long
hFirst = FindWindow(vbNullString, strTitle)
Do While hFirst <> 0
ShowWindowAsync hFirst, IIf(Show, SW_SHOW, SW_HIDE)
hFirst = FindWindowEx(0&, hFirst, vbNullString, strTitle)
Loop
End Sub
Dim hFirst As Long
hFirst = FindWindow(vbNullString, strTitle)
Do While hFirst <> 0
ShowWindowAsync hFirst, IIf(Show, SW_SHOW, SW_HIDE)
hFirst = FindWindowEx(0&, hFirst, vbNullString, strTitle)
Loop
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询