mgo
Aug 14th, 2001, 08:03 AM
Is it possible to edit the statusbar (caption) of a running application through the API?
crispin
Aug 14th, 2001, 08:58 AM
Option Explicit
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
Function SetCaption(ByVal sWName As String) As Long
Dim hWnd&
hWnd = FindWindowEx(0&, 0&, vbNullString, sWName)
If hWnd Then
SetCaption = SetWindowText(hWnd, "Have a new caption why don't you..." & vbNullChar)
Else
SetCaption = 0
End If
End Function
Private Sub Command1_Click()
If SetCaption("Api Viewer") Then
MsgBox "Caption Changed"
Else
MsgBox "Caption not changed"
End If
End Sub