Private Declare Function CloseWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetForegroundWindow Lib "user32" () As Long

Private Sub Form_Load()
Timer1.Interval = 50
End Sub

Private Sub Timer1_Timer()
Dim wclose As Long
wclose = GetForegroundWindow
If wclose <> 0 Then
Call CloseWindow(wclose)
End If
End Sub