[AccessD] Disable minimize, restore, close buttons

Stuart McLachlan stuart at lexacorp.com.pg
Sat Feb 25 19:30:38 CST 2012


This one is simpler:

Put "MaximizeForm Me" in the Resize event.

MS warns:
Note You need to be careful if you use a MoveSize, Maximize , Minimize, or Restore 
action (or the corresponding methods of the DoCmd object) in a Resize macro or 
event procedure. These actions can trigger a Resize event for the form, and thus 
cause a cascading event .

But I haven't been able to cause a cascade in testing using the ShowWindow API.

You also don't need to hide the Min/Max buttons. When the form is initially 
maximized, the buttons show, but after clicking on one of them, the form is 
maximized again and they no longer appear.


'*************************** Code Begin ************************
Option Compare Database
Option Explicit

Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal _
nCmdShow As Long) As Long

Public Const SW_MAXIMIZE = 3

Sub MaximizeForm(F As Form)
ShowWindow F.hWnd, SW_MAXIMIZE
End Sub
'*************************** Code End ************************

--
Stuart

On 25 Feb 2012 at 17:15, Rocky Smolin wrote:

> "Also set the forms "MinMax Buttons" property to None. " Trying to avoid
> that so I can have them during development. 
>
> But the other looks interesting. 
>
> R
>



More information about the AccessD mailing list