VB Code:
  1. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  2. Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
  3.  
  4. Private Const WM_CLOSE = &H10
  5.  
  6. Private Sub cmdCloseApp_Click()
  7. Dim CloseIt As Long
  8. CloseIt = FindWindow(vbNullString, "Caption Of Window To Be Closed")
  9. PostMessage CloseIt, WM_CLOSE, CLng(0), CLng(0)
  10. End Sub