I have code which will grey out the x at the top of a MDIForm. Is there away to disable the min and max buttons as well?
Printable View
I have code which will grey out the x at the top of a MDIForm. Is there away to disable the min and max buttons as well?
you just set the Control Box to false from the properties window
There isn't a controlbox property on a MDIform, or am I mistaken?
sorry I made a mistake will you ever forgive me LOL!!!
You can disable the Min and Max buttons just like you would disable the close button.
Code:Private Declare Function GetSystemMenu Lib "User32" (ByVal hWnd As Integer, ByVal bRevert As Integer) As Integer
Private Declare Function RemoveMenu Lib "User32" (ByVal hMenu As Integer, ByVal nPosition As Integer, ByVal wFlags As Integer) As Integer
Const MF_BYPOSITION = &H400
Private Sub MDIForm_Load()
RemoveMenu GetSystemMenu(hWnd, 0), 6, MF_BYPOSITION 'Disable Close
RemoveMenu GetSystemMenu(hWnd, 0), 4, MF_BYPOSITION 'Disable Maximize
RemoveMenu GetSystemMenu(hWnd, 0), 3, MF_BYPOSITION 'Disable Minimize
End Sub
Dimava:
I wasn't trying to be a smart ass. Thanks anyway.
Megatron:
Thank you once agin for your help.
Dimava:
I wasn't trying to be a smart ass. Thanks anyway.
Megatron:
Thank you once again for your help.
Megatron:
The x on the MDIform appears gray (Great) but the min and max button still are enabled. I cpoied the code from your post. What am I doing wrong?
Using VB6 Prof. in Win98
Or better yet, clear them all in one call. ;)
question:Code:Private Declare Function DestroyMenu _
Lib "user32" ( _
ByVal hMenu As Long _
) As Long
Private Declare Function GetSystemMenu Lib "User32" (ByVal hWnd As Integer, ByVal bRevert As Integer) As Integer
Private Sub Form_Load
DestroyMenu(GetSystemMenu(me.Hwnd, False))
End sub
What is the function to gray out menu's?