CodeItBetter Programming Another VB Programming Blog

How to add a minimize Button to Form that has fixed Border

Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
'Forms - How to add a minimize Button to Form that has fixed Border

Option Explicit
 
'Set the form BorderStyle property to 1 - Fixed Single or 3 - Fixed Dialog.

Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, _
    ByVal nIndex As Long) As Long
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, _
    ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Const GWL_STYLE = (-16)
Public Const WS_MINIMIZEBOX = &H20000
Public Const WS_MAXIMIZEBOX = &H10000
 
Private Function AddMinimizeButton(po_Form As Form)
   Dim ll_Style As Long
   ll_Style = GetWindowLong(po_Form.hwnd, GWL_STYLE)
   Call SetWindowLong(po_Form.hwnd, GWL_STYLE, ll_Style Or WS_MINIMIZEBOX)
End Function
 
Private Sub Form_Load()
    Call AddMinimizeButton(Me)
End Sub
Filed under: Forms Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.