Userform de excel en la barra de tareas de windows
Hace un momento hice esta pregunta mas no se si ya se publico es la primera vez que hago una pregunta en este foro disculpen mi ignorancia bueno es la siguiente tengo un userform con los botones de minimizar maximizar con el siguiente codigo que saque de esta pagina por cierto y bueno con ese codigo me minimiza el userform y me lo pone flotante me gustaria saber si hay alguna forma de que cuando se minimize lo haga a la barra de tareas de windows como sui fuera un programa normal como excel wor o cualquier otro se podra?
El codigo de los botones es este diganme que le pongo por favor si es que se puede
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
'Constants used within the API functions above
Private Const WS_MINIMIZEBOX As Long = &H20000
Private Const WS_MAXIMIZEBOX As Long = &H10000
Private Const GWL_STYLE As Long = (-16)
Private Sub UserForm_Initialize()
Dim lngMyHandle As Long, lngCurrentStyle As Long, lngNewStyle As Long
'Get the Windows handle of the userform - required for the API calls
If Application.Version < 9 Then
lngMyHandle = FindWindow("THUNDERXFRAME", Me.Caption) 'For Excel 97
Else
lngMyHandle = FindWindow("THUNDERDFRAME", Me.Caption) 'For Excel 2000 onwards
End If
'Get the current style of the userform
lngCurrentStyle = GetWindowLong(lngMyHandle, GWL_STYLE)
'Create a new style with max and min buttons
lngNewStyle = lngCurrentStyle Or WS_MINIMIZEBOX Or WS_MAXIMIZEBOX
'Apply it to the userform
SetWindowLong lngMyHandle, GWL_STYLE, lngNewStyle
End Sub
El codigo de los botones es este diganme que le pongo por favor si es que se puede
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
'Constants used within the API functions above
Private Const WS_MINIMIZEBOX As Long = &H20000
Private Const WS_MAXIMIZEBOX As Long = &H10000
Private Const GWL_STYLE As Long = (-16)
Private Sub UserForm_Initialize()
Dim lngMyHandle As Long, lngCurrentStyle As Long, lngNewStyle As Long
'Get the Windows handle of the userform - required for the API calls
If Application.Version < 9 Then
lngMyHandle = FindWindow("THUNDERXFRAME", Me.Caption) 'For Excel 97
Else
lngMyHandle = FindWindow("THUNDERDFRAME", Me.Caption) 'For Excel 2000 onwards
End If
'Get the current style of the userform
lngCurrentStyle = GetWindowLong(lngMyHandle, GWL_STYLE)
'Create a new style with max and min buttons
lngNewStyle = lngCurrentStyle Or WS_MINIMIZEBOX Or WS_MAXIMIZEBOX
'Apply it to the userform
SetWindowLong lngMyHandle, GWL_STYLE, lngNewStyle
End Sub
1 Respuesta
Respuesta de macros_excel
1