SetWindowText Function

Declare Function SetWindowText Lib "user32.dll" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long

Platforms: Win 32s, Win 95/98, Win NT

SetWindowText changes the text that appears in the title bar of a window. Although this works with any window, including ones your program doesn't own, other programs won't expect their window titles to be changed, so use this with care on windows you didn't create. The function returns 0 if an error occured, or 1 if successful.

hwnd
The handle of the window to change the title of.
lpString
The text to set as the window's title.

Example:

' Set the title bar of window Form1 to "Generic Application 1.0".
Dim retval As Long  ' return value

retval = SetWindowText(Form1.hWnd, "Generic Application 1.0")

Related Call: GetWindowText
Category: Windows
Back to the index.


Go to Paul Kuliniewicz's Home Page.
E-mail: rogue953@hotmail.com
This page is at http://skyscraper.fortunecity.com/transmission/45/api/s/setwindowtext.html