Results 1 to 7 of 7

Thread: Changing Text in Start Button

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member cameron2's Avatar
    Join Date
    Mar 2008
    Location
    Australia
    Posts
    401

    Changing Text in Start Button

    Here is the code to change the text in the start button:

    Code:
    Option Strict Off
    Public Class Form1
        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 ChangeStartButtonText(ByVal str As String)
            Try
                Dim StartButton As Integer
                Dim StartButtonText As Integer
                Dim Caption As String
                StartButton = FindWindow("Shell_TrayWnd", vbNullString)
                StartButtonText = FindWindowEx(StartButton, 0&, "button", vbNullString)
                Caption = Mid(str, 1, 5)
                SendMessageSTRING(StartButtonText, WM_SETTEXT, 256, Caption)
            Catch ex As Exception
            End Try
        End Sub
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            ChangeStartButtonText(TextBox1.Text)
        End Sub
    End Class
    WARNING! If you set the text to more than 5 characters it will be cut off.

    If you like this code please rate it and leave feedback.
    Thanks!
    Last edited by cameron2; Apr 7th, 2008 at 07:35 AM.
    If this post helped you, please click the rate button to say thank you! Remember to mark the thread as resolved too.
    Autoclicker, Hide Taskbar, Sounds on internal speaker, Changing Start Button Text (with code)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width