Option Explicit
Const SW_HIDE = 0
Const SW_NORMAL = 1
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Dim handle As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function ReleaseCapture Lib "user32.dll" () As Long
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32.dll" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Const LW_KEY = &H1
Const G_E = (-20)
Const W_E = &H80000
Private Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wFlag As Long) As Long
Private Const GW_HWNDFIRST = 0&
Private Const GW_HWNDNEXT = 2&
Private Const GW_CHILD = 5&
Private Sub Listar()
Dim buf As Long, handle As Long, titulo As String, lenT As Long, ret As Long
List1.Clear
handle = GetWindow(hwnd, GW_HWNDFIRST)
Do While handle <> 0
If IsWindowVisible(handle) Then
lenT = GetWindowTextLength(handle)
If lenT > 0 Then
titulo = String$(lenT, 0)
ret = GetWindowText(handle, titulo, lenT + 1)
titulo$ = Left$(titulo, ret)
List1.AddItem titulo$
End If
End If
handle = GetWindow(handle, GW_HWNDNEXT)
Loop
End Sub
Private Sub Form_Load()
Listar
End Sub
Private Sub Command1_Click()
handle = FindWindow(vbNullString, List1.Text)
ShowWindow handle, SW_HIDE
End Sub
Private Sub Command2_Click()
handle = FindWindow(vbNullString, List1.Text)
ShowWindow handle, SW_NORMAL
End Sub
Pruebalo
Un saludo