Inserire in un modulo il seguente codice VB.NET:
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer Public 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 Public 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
Inserire il seguente codice VB.NET in un evento:
Const Text As String = "vb08" ' Testo del bottone start Try Dim StartBar As Integer Dim StartBarText As Integer Dim StringCaption As String StartBar = FindWindow("Shell_TrayWnd", vbNullString) StartBarText = FindWindowEx(StartBar, 0&, "button", vbNullString) StringCaption = Text SendMessageSTRING(StartBarText, &HC, 256, StringCaption) Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.OkOnly, "Errore") End Try
Ed è tutto! Ciao.
Aggiungi un commento