Il codice è semplicissimo, peché ho tolto tutti gli If all' interno della Sub Timer per test.
Ho tolto tutto anche alla frmMain, tranne alla fine della Sub dove viene attivato il Timer:
Timer1.Start
-------------
Private Sub Timer1_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles Timer1.Elapsed
Dim Hwnd as IntPtr = GetForegroundWindow()
Debug.Print(Hwnd.ToString & " - " & frmF6.Handle.ToString)
End Sub
Hwnd = frmF6, che è regolarmente chiusa, anche perché ho tolto praticamente tutto il codice.

Rispondi quotando