Attribute VB_Name = "Lock" Option Explicit Public Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long Public Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long Public Declare Function BlockInput Lib "user32" (ByVal fBlock As Long) As Long Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Window_to_Search As Long Public tim As Integer Public Task_Manager_Caption As String Public Sub TimerProc(ByVal lhwnd As Long, ByVal uMsg As Long, ByVal idEvent As Long, ByVal dwTime As Long) Window_to_Search = FindWindow(vbNullString, Task_Manager_Caption) If Window_to_Search > 0 Then SendKeys "%{F4}", True Form1.SetFocus BlockInput True End If End Sub