VB Code:
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
Private Declare Function SetWindowText Lib "User32" Alias "SetWindowTextA" (ByVal hWnd&, ByVal lpString$) As Boolean
Private Function SetCaption(ByVal WindowName As String) As Long
Dim hWnd As Long
hWnd = FindWindowEx(0&, 0&, vbNullString, WindowName)
If hWnd Then
SetCaption = SetWindowText(hWnd, "Have a new caption why don't you..." & vbNullChar)
Else
SetCaption = 0
End If
End Function
'Usage:
Call SetCaption("Current Caption")
'Where Current Caption is the actual caption of the running application