Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change text on the start button

How-to

Change text on the start button

by  PsychoCoder  Posted    (Edited  )
Below is a simple procedure for changing the text on the Windows Start Button. Now I'm not sure why you would want to do this, unless say you're creating an application in multiple languages and want to change the text to that language (though I imagine most who use a different language have the Local set to theirs):

Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
            (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
    Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
    (ByVal hWnd1 As Integer, ByVal hWnd2 As Integer, ByVal lpsz1 As String, ByVal lpsz2 As String) As Integer
    Private Declare Function SendMessageSTRING Lib "user32" Alias "SendMessageA" _
    (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As String) As Integer

    Private Const WM_SETTEXT = &HC
    Private Const WM_GETTEXT = &HD

        

Public Sub SetStartCaption(ByVal str As String)
   Try
     Dim StartBar As Integer
     Dim StartBarText As Integer
     Dim sCaption As String
     StartBar = FindWindow("Shell_TrayWnd", vbNullString)
     StartBarText = FindWindowEx(StartBar, 0&, "button", vbNullString)
     sCaption = Mid(str, 1, 5)
     SendMessageSTRING(StartBarText, WM_SETTEXT, 256, sCaption)
   Catch ex As Exception
   End Try
End Sub

Keep in mind that this wont change it forever, or even for a period of time you specify as every so often Windows frees memory and redraws the UI, thus reverting to the original start button text.

Enjoy
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top