Option Explicit
Private Declare PtrSafe Function StartWindow Lib "user32" Alias "GetWindowLongA" ( _
ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare PtrSafe Function MoveWindow Lib "user32" Alias "SetWindowLongA" ( _
ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare PtrSafe Function FindWindowA Lib "user32" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Const STYLE_CURRENT As Long = (-16) '// A new window STYLE
'// Window STYLE
Private Const WS_CX_MINIMIZAR As Long = &H20000 '// Minimize button
Private Const WS_CX_MAXIMIZAR As Long = &H10000 '// Maximize button
'// Window status
Private Const SW_EXIBIR_NORMAL = 1
Private Const SW_EXIBIR_MINIMIZADO = 2
Private Const SW_EXIBIR_MAXIMIZADO = 3
Dim Form_Personalized As Long
Dim STYLE As Long
Private Sub UserForm_Activate()
Form_Personalized = FindWindowA(vbNullString, Me.Caption)
STYLE = StartWindow(Form_Personalized, STYLE_CURRENT)
STYLE = STYLE Or WS_CX_MINIMIZAR '// Minimize button
STYLE = STYLE Or WS_CX_MAXIMIZAR '// Maximize button
MoveWindow Form_Personalized, STYLE_CURRENT, (STYLE)
End Sub
Option Explicit
Private Declare Function StartWindow Lib "user32" Alias "GetWindowLongA" ( _
ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function MoveWindow Lib "user32" Alias "SetWindowLongA" ( _
ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function FindWindowA Lib "user32" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Const STYLE_CURRENT As Long = (-16) '// A new window STYLE
'// Window STYLE
Private Const WS_CX_MINIMIZAR As Long = &H20000 '// Minimize button
Private Const WS_CX_MAXIMIZAR As Long = &H10000 '// Maximize button
'// Window status
Private Const SW_EXIBIR_NORMAL = 1
Private Const SW_EXIBIR_MINIMIZADO = 2
Private Const SW_EXIBIR_MAXIMIZADO = 3
Dim Form_Personalized As Long
Dim STYLE As Long
''CODE_2**********************************
Form_Personalized = FindWindowA(vbNullString, Me.Caption)
STYLE = StartWindow(Form_Personalized, STYLE_CURRENT)
STYLE = STYLE Or WS_CX_MINIMIZAR '// Minimize button
STYLE = STYLE Or WS_CX_MAXIMIZAR '// Maximize button
MoveWindow Form_Personalized, STYLE_CURRENT, (STYLE)
End Sub