Menonaktifkan tombol Maximize yang terdapat di MDIForm

0 comments
Source Code :
Option Explicit

Private Declare Function GetWindowLong Lib "user32" _
Alias "GetWindowLongA" (ByVal hWnd As Long, _
ByVal nIndex 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 Const GWL_STYLE = (-16)
Private Const WS_MINIMIZEBOX = &H20000
Private Const WS_MAXIMIZEBOX = &H10000

Public Sub NoMaxBox(f As MDIForm)
Dim l As Long
l = GetWindowLong(f.hWnd, GWL_STYLE)
l = l And Not (WS_MAXIMIZEBOX)
l = SetWindowLong(f.hWnd, GWL_STYLE, l)
End Sub

Public Sub NoMinBox(f As MDIForm)
Dim l As Long
l = GetWindowLong(f.hWnd, GWL_STYLE)
l = l And Not (WS_MINIMIZEBOX)
l = SetWindowLong(f.hWnd, GWL_STYLE, l)
End Sub

Private Sub MDIForm_Load()
NoMaxBox Me 
'NoMinBox Me
End Sub

Private Sub MDIForm_Resize()
'Ganti 4800 di bawah dgn lebar form yg fix Anda tentukan
'Ganti 3600 di bawah dgn tinggi form yg fix Anda tentukan
If Me.Width <> 4800 Then Me.Width = 4800
If Me.Height <> 3600 Then Me.Height = 3600
End Sub



Related Post :



0 comments:

Post a Comment

 
VB Source Code | © 2011 Design by DheTemplate.com and Theme 2 Blog

Find more free Blogger templates at DheTemplate.com - Daily Updates Free Blogger Templates