0% found this document useful (0 votes)
163 views

Minimize and Maximize Button Code

This document contains code to customize the window style of a form in a program. It declares functions to find the window, get the current window style, and update the style. These functions are used to add minimize and maximize buttons to the form window by getting the current style, combining it with constants for those button styles, and setting the new style.

Uploaded by

minyak pusaka
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
163 views

Minimize and Maximize Button Code

This document contains code to customize the window style of a form in a program. It declares functions to find the window, get the current window style, and update the style. These functions are used to add minimize and maximize buttons to the form window by getting the current style, combining it with constants for those button styles, and setting the new style.

Uploaded by

minyak pusaka
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 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