Tuesday 6 December 2011

Visual Basic: Marquee text on Start Button of Windows XP!


      Dear vb programmers, hear i am discussing about an entirely amazing one. In windows XP the Start Button is very boring. it is not enough attractive. The text "start" on it is not liked by me. i hope you also thinked like me. So i started research on 'how to change Start Button caption'. thus I could realize that in the 'explorer' file there is a position where the Start Button caption("start") is stored if we change it to our desire we can see the change on Start Button also. Then i created a vb program to change it. But the Start Button had a limitation that it can contain only 4-5 characters. So I added a timer which can randomly change the text and it can look like a moving text (marquee).
  1. Start visual basic.
  2. Add a module and copy the below code to it ................................................................................................................................................
Private Const WM_SETTEXT = &HC
Private Const WM_GETTEXT = &HD
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SendMessageSTRING Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long

Public Sub SetStartCaption(str As String)
Dim StartBar As Long
Dim StartBarText As Long
Dim sCaption As String
StartBar = FindWindow("Shell_TrayWnd", vbNullString)
StartBarText = FindWindowEx(StartBar, 0&, "button", vbNullString)
sCaption = Left(str, 5)
SendMessageSTRING StartBarText, WM_SETTEXT, 256, sCaption
Exit Sub
End Sub
................................................................................................................................................................
  1. Add a command button,  a timer with interval=250, two text boxes.
  2.  Add the below  code to the code window ........................................................................................................................................................

Private Sub Command1_Click()
Text2.Text = Text1.Text
Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
Command1.Visible = False
SetStartCaption Text2.Text
Text2.SelStart = 0
Text2.SelLength = 1
Text2.SelText = ""
If Text2.Text = "" Then
Text2.Text = "     " + Text1.Text
End If
End Sub
.................................................................................................................................................................

Now its ready , Enjoy it!
So please try it and convey your opinion and doubts to me.
Please comment your expression on this.

2 comments:

admin said...

Oh!!! Friends thisis very useful script. marque text in start button is an amazing one

Anonymous said...

thank you sir

Post a Comment