La Web del Programador: Comunidad de Programadores
 
    Pregunta:  43043 - PASAR EL FOCO ACTIVO A UNA APPLICACIÓN ABIERTA Y MAXIMIZARLA
Autor:  Clemente Sanchez
Necesito pasarle el foco desde mi formulario activo, a una segunda aplicación, de modo que pase a ser la activa y la visible, y además maximizarla automáticamente, en el caso de que esté minimizada...
¿Alguna idea de cómo hacerlo? Con API's de Windows?

Un saludo y Gracias

  Respuesta:  Emilio Gonzalez
Con esta funcion podes manipular cualquier objeto que tenga una propiedad hWnd(Ventanas, Pictures, etc)

En un modulo:
Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

Public hwndActual As Long

En un Form, (Ej: llamada por botones):

Private Sub Minimizar_Click()
ShowWindow hwndCurrentWindow, 2
End Sub

Private Sub Maximizar_Click()
ShowWindow hwndCurrentWindow, 3
End Sub

Private Sub Ocultar_Click()
ShowWindow hwndCurrentWindow, 0
End Sub

Private Sub Mostrar_Click()
ShowWindow hwndCurrentWindow, 5
End Sub

Private Sub Restaurar_Click()
ShowWindow hwndCurrentWindow, 9
End Sub

Private Sub Recargar_Click()
ShowWindow hwndCurrentWindow, 10
End Sub