This code may come in handy
I just threw this together, maybe it will work.
After the time period runs out, just call this function from a timer. It will minimize all windows except your application.
Code in Module:
VB Code:
Option Explicit
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Const WS_MINIMIZEBOX = &H20000
Private Const GWL_STYLE = (-16)
Private Declare Function IsWindowVisible& Lib "user32" (ByVal hwnd As Long)
Private Declare Function ShowWindow& Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long)
Private Const SW_SHOWMINIMIZED = 2
Private Declare Function EnumWindows Lib "user32.dll" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Dim m_lHwnd As Long
Public Sub MinimizeExcept(ByVal sCaption As String)
m_lHwnd = FindWindowEx(0, 0, vbNullString, sCaption)
If m_lHwnd Then
EnumWindows AddressOf EnumWindowsProc, 0&
End If
End Sub
Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
Dim lStyle As Long
If hwnd <> m_lHwnd Then
lStyle = GetWindowLong(hwnd, GWL_STYLE)
If (lStyle And WS_MINIMIZEBOX) = WS_MINIMIZEBOX And IsWindowVisible(hwnd) Then
Call ShowWindow(hwnd, SW_SHOWMINIMIZED)
End If
End If
EnumWindowsProc = 1
End Function
Example usage:
VB Code:
Call MinimizeExcept("Security App Caption Goes Here")