' API & Constant
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA"
(ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA"
(ByVal hwnd As Int32, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal
lParam As Int32) As Int32
Private Const WM_CLOSE = &H10
' Put this behind a button for example:
Dim intHandle As Integer = FindWindow("Notepad", vbNullString)
If intHandle > 0 Then
SendMessage(intHandle, WM_CLOSE, 0, 0)
End If
I used 'Notepad in the above example & found the handle by passing the
classname to the FindWindow function
I hope this helps