|
|
Title | Set another application's caption |
Description | This example shows how to set another application's caption in Visual Basic 6. |
Keywords | caption, title, SendMessage, application title |
Categories | Windows, Software Engineering, API |
|
|
The program uses FindWindow to get the target's window handle. Then it uses SendMessage with the WM_SETTEXT message to set the caption.
|
|
Private Sub Command1_Click()
Dim target_hwnd As Long
Dim target_name As String
Dim new_caption As String
' Find the target.
target_name = txtCaption.Text
target_hwnd = FindWindow(vbNullString, target_name)
If target_hwnd = 0 Then
MsgBox "Cannot find target"
Exit Sub
End If
new_caption = txtNewCaption.Text
SendMessage target_hwnd, WM_SETTEXT, 0, _
ByVal new_caption
End Sub
|
|
|
|
|
|