Search Tools Links Login

Change Start Button Text


Visual Basic 6, or VB Classic

Example of FindWindowEx and SendMessage

Original Author: steve0

Code

Option
Explicit

'

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 SendMessage Lib "user32"
Alias "SendMessageA" ( _

          
                                       
ByVal hwnd As Long, _

          
                                       
ByVal wMsg As Long, _

          
                                       
ByVal wParam As Long,
_

          
                                       
          
lParam As Any _

          
                                       
          
) As Long

                                       
'

Const WM_SETTEXT As Long = &HC

'

Public Sub ChangeSB(sNewText As String)

     
  '

      Dim hWnd_ As
Long

      '

     
  hWnd_ = FindWindowEx(0&, 0&, "Shell_TrayWnd",
vbNullString)

    '

     
  If (hWnd_ > 0) Then

          
   '

          
   hWnd_ =
FindWindowEx(hWnd_, 0&, "Button", vbNullString)

          
   '

           If (hWnd_ >
0) Then

    
           
    
'

    
           
    
SendMessage hWnd_, WM_SETTEXT, 0&, ByVal sNewText

    
           
    
'

           End If

          
   '

      End If

     
  '

End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 129 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.