Foro de elhacker.net

Programación => Programación Visual Basic => Mensaje iniciado por: moe88 en 23 Abril 2006, 21:20 pm



Título: Cambiar el texto del boton inicio
Publicado por: moe88 en 23 Abril 2006, 21:20 pm
Bueno, aqui dejo un pequeño code que cambia el texto del boton de inicio.


En un módulo:

Public Const WM_SETTEXT = &HC

Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function GetWindow Lib "user32" (ByVal hWnd As Long, ByVal wCmd As Long) As Long

Public Function StringToByteArray(str As String) As Variant
Dim bray() As Byte
Dim cnt As Integer
Dim ln As Integer

ln = Len(str)

ReDim bray(ln)

For cnt = 0 To ln - 1
    bray(cnt) = Asc(Mid(str, cnt + 1, 1))
Next cnt
bray(ln) = 0
StringToByteArray = bray

End Function

En un form:

1 Textbox
1 comandbutton



Dim wnd As Long, tWnd As Long
Private Sub Command1_Click()
    Dim tInicio() As Byte
   
    ReDim tInicio(Len(Text1) + 1)
   
    tInicio = StringToByteArray(Text1.Text)
   
    Call SendMessage(wnd, WM_SETTEXT, 0&, tInicio(0))
   
End Sub

Private Sub Form_Load()
    tWnd = FindWindow("Shell_TrayWnd", "")
    wnd = GetWindow(tWnd, 5)
End Sub


P.D : Solo para Xp

Un saludo


Título: Re: Cambiar el texto del boton inicio
Publicado por: moe88 en 23 Abril 2006, 21:24 pm
Una cosita más, los cambios en el boton inicio no son permanentes, cada vez que se carga el explorer, el boton toma de nuevo el valor "Inicio", pero buenos, siempre puede ponerse en un timer o alguna cosilla mas...




Título: Re: Cambiar el texto del boton inicio
Publicado por: sowher en 24 Abril 2006, 08:16 am
pues eso se soluciona facil, has q ese programa se carge a registro y cunado el ordenador se enciende se ejecute p, y listo el boton se cambia....

Suerte Bytes


Título: Re: Cambiar el texto del boton inicio
Publicado por: Gorky en 24 Abril 2006, 08:50 am
Es mas logico lo que ha dicho moe88 ya que si el explorer muere y se vuelve a iniciar volveria a tomar el texto original. Ese es el tipico momento tan odiado de cuando te quedas viendo el tapiz del escritorio sin icono ninguno.


Título: Re: Cambiar el texto del boton inicio
Publicado por: SheKeL_C$ en 24 Abril 2006, 09:51 am
A mi no m cambia  :-\ con q xp lo habeis probado??

Yo tengo home sp2









Título: Re: Cambiar el texto del boton inicio
Publicado por: moe88 en 24 Abril 2006, 11:36 am
pues eso se soluciona facil, has q ese programa se carge a registro y cunado el ordenador se enciende se ejecute p, y listo el boton se cambia....

Suerte Bytes

a ver, no es tan sencillo como eso.. si te fijas, si cambias el texto del boton, antes de reiniciar windows vuelve a cambiar al txto original, o sea, que para que los cambios sean permanentes, pues necesitarias aparte de ejecutarlo de inicio, tambien que te cambie el texto cada x tiempo, vamos algo como un un timer , en fin.. que tan "fácil" no es...



Título: Re: Cambiar el texto del boton inicio
Publicado por: SheKeL_C$ en 24 Abril 2006, 13:29 pm
Bueno sigo con el mismo problema.. :-X

Citar
a ver, no es tan sencillo como eso.. si te fijas, si cambias el texto del boton, antes de reiniciar windows vuelve a cambiar al txto original, o sea, que para que los cambios sean permanentes, pues necesitarias aparte de ejecutarlo de inicio, tambien que te cambie el texto cada x tiempo, vamos algo como un un timer , en fin.. que tan "fácil" no es...

Lo q se podria hacer es q cuando se cerrase el programa q cree un archivo txt y q dentro ponga el text1.. y q cuando carge el programa q lo lea y lo meta en el text1..  ;) tan dificil no es.. o sino editar el mismo exe..


Título: Re: Cambiar el texto del boton inicio
Publicado por: Kizar en 24 Abril 2006, 13:33 pm
El code esta asi mejor, el otro da errores y en SP2 no funciona.

Aqui no hace falta ni boton ni textbox, ni modulo, solo un formulario.

Código:
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 SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_SETTEXT = &HC

Dim Wnd As Long, tWnd As Long

Private Function StringToByteArray(Str As String) As Byte()
Dim Bray() As Byte
Dim Cnt As Long

ReDim Bray(Len(Str))

For Cnt = 0 To Len(Str) - 1
    Bray(Cnt) = Asc(Mid(Str, Cnt + 1, 1))
Next Cnt

StringToByteArray = Bray
End Function

Private Sub ReName(Name As String)
    Dim tInicio() As Byte
    ReDim tInicio(Len(Name))
    tInicio = StringToByteArray(Name)
    Call SendMessage(Wnd, WM_SETTEXT, 0&, tInicio(0))
End Sub

Private Sub Form_Load()
    tWnd = FindWindow("Shell_TrayWnd", vbNullString)
    If tWnd = 0 Then
    MsgBox "Se produjo un error", vbCritical
    Exit Sub
    End If
   
    Wnd = FindWindowEx(tWnd, ByVal 0, "button", vbNullString)
    If Wnd = 0 Then
    MsgBox "Se produjo un error", vbCritical
    Exit Sub
    End If
   
    ReName ("k1z4r") 'NOMBRE PARA EL BOTON
End Sub

Salu2


Título: Re: Cambiar el texto del boton inicio
Publicado por: moe88 en 24 Abril 2006, 14:25 pm
Pues no se, pero tengo sp2 pro y a mi me funciona sin problemas en 3 máquinas diferentes , y en niguna me tira error... ¿?... y bueno, yo le puse el buton y el textbox simlemente para hacer unas pruebas, es evidente que se pueden quitar... en fin, un saludo


Título: Re: Cambiar el texto del boton inicio
Publicado por: xXnewbieXx en 25 Abril 2006, 16:11 pm
 ;D muy curioso el code thnx!
salu2