
14/07/2009, 13:55
|
| | Fecha de Ingreso: enero-2007 Ubicación: Tingo María - Perú
Mensajes: 399
Antigüedad: 18 años, 3 meses Puntos: 13 | |
Respuesta: [Source] Cambiar el Texto de boton "Inicio" o "start" navegando encontre:
Código:
TaskBarHandle = FindWindow('Shell_TrayWnd', nil)
GetWindowRect(TaskBarHandle, TaskBarRect);
ReBarWindow32Handle = FindWindowEx(TaskBarHandle, 0, 'ReBarWindow32', nil)
GetWindowRect(ReBarWindow32Handle, ReBarWindow32Rect);
GetWindowRect(FindWindowEx(TaskBarHandle, 0, 'TrayNotifyWnd', nil),TrayNotifyWndRect);
NewLabelWidth = MainForm.Canvas.TextWidth(TrimRight(NewLabel)) + 64;
if NewLabelWidth < StartBtnWidth then
NewLabelWidth = StartBtnWidth;
end if
NewReBarWindow32Width = (TaskBarRect.Right - TaskBarRect.Left) -(TrayNotifyWndRect.Right - TrayNotifyWndRect.Left) - NewLabelWidth
SendMessage(StartHandle, WM_SETTEXT, 0, Integer(@NewLabel))
SetWindowPos(ReBarWindow32Handle, 0, NewLabelWidth + 5, 0,NewReBarWindow32Width, TaskBarRect.Bottom - TaskBarRect.Top, SWP_SHOWWINDOW)
SetWindowPos(StartHandle, 0, 0, 0, NewLabelWidth, StartBtnHeight,SWP_SHOWWINDOW)
adaptandolo un poco a tu codigo obtuve:
Código:
Option Explicit
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Const SWP_SHOWWINDOW = &H40
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
Private Declare Function GetWindowRect Lib "User32" (ByVal hWnd As Long, lpRect As RECT) As Long
Private Declare Sub SetWindowPos Lib "User32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)
Public Sub SetStartCaption(str As String)
Dim TaskBarRect As RECT, ReBarWindow32Rect As RECT, TrayNotifyWndRect As RECT
Dim TaskBarHandle As Long, ReBarWindow32Handle As Long, NewLabelWidth As Long, NewReBarWindow32Width As Long
TaskBarHandle = FindWindow("Shell_TrayWnd", vbNullString)
Call GetWindowRect(TaskBarHandle, TaskBarRect)
ReBarWindow32Handle = FindWindowEx(TaskBarHandle, 0, "ReBarWindow32", vbNullString)
Call GetWindowRect(ReBarWindow32Handle, ReBarWindow32Rect)
Call GetWindowRect(FindWindowEx(TaskBarHandle, 0, "TrayNotifyWnd", vbNullString), TrayNotifyWndRect)
NewLabelWidth = Len(str) + 64
NewReBarWindow32Width = (TaskBarRect.Right - TaskBarRect.Left) - (TrayNotifyWndRect.Right - TrayNotifyWndRect.Left) - NewLabelWidth
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, 255)
SendMessageSTRING StartBarText, WM_SETTEXT, 256, sCaption
Call SetWindowPos(ReBarWindow32Handle, 0, NewLabelWidth + 5, 0, NewReBarWindow32Width, TaskBarRect.Bottom - TaskBarRect.Top, SWP_SHOWWINDOW)
Call SetWindowPos(StartBarText, 0, 0, 0, NewLabelWidth, 20, SWP_SHOWWINDOW)
End Sub
Private Sub Command1_Click()
SetStartCaption Text1.Text
End Sub
__________________ Vivir para ser buenos y ser buenos para servir mejor. |