You have to know the ClassName of the application you want to change the title of.
To find out, you can use a utility called Spy++.
You can use either FindWindow or FindWindowEx to get the hWnd, then use SetWindowText (or basically the same: SendMessage with WM_SETTEXT) to replace the title.
Example:
------------------Code:Option Explicit Private Declare Function FindWindow Lib "User32.DLL" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function SetWindowText Lib "User32.DLL" Alias "SetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String) As Long ' The ClassName of the Notepad which comes with Windows is "Notepad". Private Const NotepadClassName = "Notepad" ' Other ClassNames you can use: Private Const CalculatorClassName = "SciCalc" Private Const VBClassName = "wndclass_desked_gsk" Private Const DosWindowClassName = "tty" Private Const FreeCellClassName = "FreeWClass" Private Const MineSweeperClassName = "Minesweeper" Private Const SolitaireClassName = "Solitaire" Private Sub Command1_Click() Dim hWindow As Long ' First, find the hWnd: hWindow = FindWindow(NotepadClassName, vbNullString) ' Then, change the title: Call SetWindowText(hWindow, "Visual Basic on a REALLY bad day!") End Sub
Yonatan
Teenage Programmer
E-Mail: [email protected]
ICQ: 19552879
AIM: RYoni69
[Don't notice what it says down there... Nobody ever edited this message!]
[This message has been edited by Yonatan (edited 12-10-1999).]




Reply With Quote