Código:
Option Explicit
Const WS_CHILD = &H40000000
Const WM_LBUTTONDOWN = &H201
Const WM_LBUTTONUP = &H202
Const SW_HIDE = 0
Const SW_NORMAL = 1
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
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 FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long
Private Declare Function DestroyWindow Lib "user32" (ByVal hwnd As Long) As Long
Dim tWnd As Long, bWnd As Long, ncWnd As Long
Para ocultar el botón :
'Obtenemos el handle de la barra de tareas
tWnd = FindWindow("Shell_TrayWnd", vbNullString)
'Obtenemos el handle del botón de inicio
bWnd = FindWindowEx(tWnd, ByVal 0&, "BUTTON", vbNullString)
'Ocultamos el borón de inicio
ShowWindow bWnd, SW_HIDE
Para volver a mostrarlo :
ShowWindow bWnd, SW_NORMAL
Si además queremos poner uno en su lugar haremos :
Para ocultar el botón y mostrar el nuestro :
Dim R As RECT
'Obtenemos el handle de la barra de tareas
tWnd = FindWindow("Shell_TrayWnd", vbNullString)
'Obtenemos el handle del botón de inicio
bWnd = FindWindowEx(tWnd, ByVal 0&, "BUTTON", vbNullString)
'Obtenemos la posición del mismo
GetWindowRect bWnd, R
'Creamos un nuevo botón
ncWnd = CreateWindowEx(ByVal 0&, "BUTTON", "Hello !", WS_CHILD, 0, 0, R.Right - R.Left, R.Bottom - R.Top, tWnd, ByVal 0&, App.hInstance, ByVal 0&)
'Mostramos nuestro botón
ShowWindow ncWnd, SW_NORMAL
'Ocultamos el borón de inicio
ShowWindow bWnd, SW_HIDE
Para ocultar el nuestro y volver a mostrar el original :
'Mostrar el botoón de inicio
ShowWindow bWnd, SW_NORMAL
'Destuir el nuestro
DestroyWindow ncWnd
Marcadores