Quote Originally Posted by dr3vi1
Yes Putty always has the Same Window Caption, by window caption you mean the title in the top of the window, correct? Like the title in the top left of the Man I can't believe the responce of this forum, Thanks everyone.
Yep, thats what I mean. This should fix you up.
VB Code:
  1. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
  2. (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  3. Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" _
  4. (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
  5. ByVal lParam As Long) As Long
  6.  
  7. Private Const WM_CLOSE = &H10
  8.  
  9. Private Sub cmdCloseApp_Click()
  10. Dim lngCloseIt As Long
  11. lngCloseIt = FindWindow(vbNullString, "Caption Of Window To Be Closed")
  12. PostMessage CloseIt, WM_CLOSE, CLng(0), CLng(0)
  13. End Sub