|
-
Oct 15th, 2001, 06:50 PM
#1
Thread Starter
New Member
Disable Minimize/Maximize/Exit window buttons
How do you disable the minimize/maximize/exit buttons in the upper-right corner of a form control? I'd just like to grey them out.
Thanks in advance,
spanqy
Mark Sanchez
SPEC Services, Inc.
Fountain Valley, CA USA
-
Oct 15th, 2001, 09:04 PM
#2
Fanatic Member
Add the following code to a module:
Code:
Option Explicit
Public Const MF_BYPOSITION = &H400&
Public Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Public Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Public Sub DisableMinimizeButton(lhWnd As Long)
Dim hSystemMenu As Long
hSystemMenu = GetSystemMenu(lhWnd, 0)
Call RemoveMenu(hSystemMenu, 3, MF_BYPOSITION)
End Sub
Public Sub DisableMaxButton(lhWnd As Long)
Dim hSystemMenu As Long
hSystemMenu = GetSystemMenu(lhWnd, 0)
Call RemoveMenu(hSystemMenu, 4, MF_BYPOSITION)
End Sub
Public Sub DisableCloseWindow(lhWnd As Long)
Dim hSystemMenu As Long
hSystemMenu = GetSystemMenu(lhWnd, 0)
Call RemoveMenu(hSystemMenu, 6, MF_BYPOSITION)
Call RemoveMenu(hSystemMenu, 5, MF_BYPOSITION)
End Sub
Regards.
-
Oct 16th, 2001, 10:29 AM
#3
The Min and Max buttons can be disabled by setting the MaxButton and MaxButton properties to false.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|