Thank you, it seems to be the best solution. I was trying to pilot everything from App1 (waiting App2 to lose focus in order to get it back) but your solution is better.
For those interested, here is what I've done.
App1 :
Code:
Option Explicit
Private Sub Command1_Click()
Shell """" & App.Path & "\App2.exe"" " & Me.hWnd, vbNormalFocus
End Sub
App2:
Code:
Option Explicit
Private App1hWnd As Long
Private Declare Function SetForegroundWindow Lib "user32.dll" (ByVal hWnd As Long) As Long
Private Sub Form_Load()
App1hWnd = CLng(Command$)
End Sub
Private Sub Form_Resize()
If Me.WindowState = vbMinimized Then
If App1hWnd <> 0 Then SetForegroundWindow App1hWnd
Exit Sub
End If
End Sub