■ MDI에서 최소화, 최대화 없애기 (추후 정리)

----------------------------------------------------------------------------------------------------

Private Const GWL_STYLE = (-16)

 

Private Const WS_MAXIMIZEBOX = &H10000

 

Private Const WS_MINIMIZEBOX = &H20000

 

Private Const WS_SYSMENU = &H80000

 

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 Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long

 

 

 

Private Const SC_MAXIMIZE = &HF030&

 

Private Const SC_MINIMIZE = &HF020&

 

Private Const SC_SIZE = &HF000&

 

Private Const MF_BYCOMMAND = &H0&

 

Private Declare Function DeleteMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long

 

Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long

 

 

 

Private Sub MDIForm_Load()

 

Dim dwNewLong As Long

 

Dim hMenu As Long

 

 

 

dwNewLong = GetWindowLong(Me.hwnd, GWL_STYLE)

 

dwNewLong = dwNewLong And Not WS_MAXIMIZEBOX 'Max버튼 없앰

 

dwNewLong = dwNewLong And Not WS_MINIMIZEBOX 'Min버튼 없앰

 

dwNewLong = dwNewLong And Not WS_SYSMENU 'Sytem메뉴 없앰(주:아이콘도 사라짐)

 

SetWindowLong Me.hwnd, GWL_STYLE, dwNewLong

 

 

 

'시스템메뉴의 MAX,MIN 기능 없앰

 

hMenu = GetSystemMenu(Me.hwnd, 0)

 

DeleteMenu hMenu, SC_MAXIMIZE, MF_BYCOMMAND

 

DeleteMenu hMenu, SC_MINIMIZE, MF_BYCOMMAND

 

DeleteMenu hMenu, SC_SIZE, MF_BYCOMMAND

 

 

 

DrawMenuBar Me.hwnd

 

End Sub

----------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker
TAG

댓글을 달아 주세요