Hi Gurus!
How can I do in order to remove minimize/maximize/close button of MDIForm's caption bar?
Could anyone let me know?
DonYoung,Jeong
Printable View
Hi Gurus!
How can I do in order to remove minimize/maximize/close button of MDIForm's caption bar?
Could anyone let me know?
DonYoung,Jeong
Code:option Explicit
'this code is in a normal form and disable
'menu buttons (it does not make them disappear, however)
private Declare Function GetSystemMenu Lib "user32" (byval hWnd as Long, byval bRevert as Long) as Integer
private Declare Function DeleteMenu Lib "user32" (byval hMenu as Long, byval iditem as Long, byval wFlags as Long) as Integer
private Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA" (byval hMenu as Long, byval nPosition as Long, byval wFlags as Long, byval wIDNewItem as Long, byval lpString as Any) as Long
private Const MF_REMOVE = &H1000&
private Const SC_CLOSE = &HF060
private Const MF_BYCOMMAND = &H0
private Const MF_GRAYED = &H1
'private Const SC_MOVE = &HF010
Const SC_MAXIMIZE = &HF030
Const SC_MINIMIZE = &HF020
Private Sub Command1_Click()
Dim hWnd as Integer, hMenu as Integer, Success as Integer, wFlags as Integer
Dim nPosition as Integer
Dim idNewItem as Integer
Dim s as string
MDIForm1.Show
hMenu = GetSystemMenu(MDIForm1.hWnd, 0)
Success = DeleteMenu(hMenu, SC_CLOSE, MF_REMOVE Or MF_BYCOMMAND)
Success = DeleteMenu(hMenu, SC_MINIMIZE, MF_REMOVE Or MF_BYCOMMAND)
Success = DeleteMenu(hMenu, SC_MAXIMIZE, MF_REMOVE Or MF_BYCOMMAND)
end sub
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Michael
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater