Private Declare Function GetTopWindow  Lib "user32" _
                         (ByVal hWnd As Long) As Long
Private Declare Function GetNextWindow Lib "user32" Alias "GetWindow" _
                         (ByVal hWnd As Long, ByVal wCmd As Long) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _
                         (ByVal hWnd As Long, ByVal lpString As String, ByVal nMaxCount As Integer) As Integer
Private Declare Function PostMessage   Lib "user32" Alias "PostMessageA" _
                         (ByVal hWnd As Long, ByVal Msg As Integer, ByVal wParam As Long, ByVal lParam As Long) As Boolean

Private Const cNEXT = 2
Private Const WM_CLOSE = &H10

Dim hWnd As Long, hWndSave As Long, hImplantWnd As Long
Dim strTitle As String * 20
Dim strKillTitle As String


Sub Main
   strKillTitle = "Implant Plus"                    'Title to kill
   strTitle = ""
   hImplantWnd = 0

   hWnd = GetTopWindow(0)                           'Get window with the highest z-position

   Do
      hWndSave = hWnd                               'Save last handle
      GetWindowText(hWnd, strTitle, Len(strTitle))  'Fetching window title
      If (InStr(strTitle, strKillTitle)) Then       'Right handel found
         hImplantWnd = hWnd                         'Save handle to kill in ImplantWnd
      End If
      hWnd = GetNextWindow(hWnd, cNEXT)             'Fetching next window handle (next in z-order)
   Loop Until (InStr(strTitle, strKillTitle)<>0) _
           Or (hWnd = hWndSave)                     'Loop until right window found or no new handle available

   If (hImplantWnd) Then                            'If we got our handle to kill..
      PostMessage(hImplantWnd, WM_CLOSE, 0, 0)      '..kill it
      'MsgBox "Implant window found and closed"
   'Else
      'MsgBox "Nothing found."
   End If

End Sub




















