DISABLE MAXIMIZE BUTTON on ACCESS APPLICATION

D

Dan

Hello. I am using Access 2003 and I want to disable the primary maximize
button, not one in a form. I can disable the close button with the following
code, but the maximize doesn't work. Any suggestions? This has got me
stumped.


Const SC_CLOSE = &HF060&
Const SC_MAXIMIZE = &HF030&

Public Function SetEnabledState(blnState As Boolean)
Call CloseButtonState(blnState)
Call MaximizeButtonState(blnState)
End Function

Sub CloseButtonState(boolClose As Boolean)
Dim hwnd As Long
Dim wFlags As Long
Dim hMenu As Long
Dim result As Long

hwnd = Application.hWndAccessApp
hMenu = GetSystemMenu(hwnd, 0)
If Not boolClose Then
wFlags = MF_BYCOMMAND Or MF_GRAYED
Else
wFlags = MF_BYCOMMAND And Not MF_GRAYED
End If

result = EnableMenuItem(hMenu, SC_CLOSE, wFlags)
End Sub

Sub MaximizeButtonState(boolClose As Boolean)
Dim hwnd As Long
Dim wFlags As Long
Dim hMenu As Long
Dim result As Long

hwnd = Application.hWndAccessApp
hMenu = GetSystemMenu(hwnd, 0)
If Not boolClose Then
wFlags = MF_BYCOMMAND Or MF_GRAYED
Else
wFlags = MF_BYCOMMAND And Not MF_GRAYED
End If

result = EnableMenuItem(hMenu, SC_MAXIMIZE, wFlags)

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top