Minimize and Maximize Button Code

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

''CODE_1**********************************

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)

You might also like