How to hide Minimise, Restore and close window of the form

How to hide/disable the minimise, Restore and close buttons which are available at the upper right side of the form.

I want user the use only CommandButton provided on each form to close the form.

 

Note : All the forms in my database has a menu and no toolbar.

 

Please advice.

Regards

Irshad

 

 

Answer
Answer

Any possibe guide line on my posted vba code which I am using for resizing the form.

So that I can do some changes and my requirement can be obtained.

 


I'm sorry, but I don't have enough spare time to rewrite such extensive code, even if I thought it could be done in such a manner as to meet your requirement.  A brief examination of the code suggests to me that it could work whether your forms are maximized or not -- it does a little something extra if a form is maximized, but it still resizes the form and its controls even if the form is not maximized.

If I am right, there is still nothing keeping you from dynamically sizing the restored (that is, non-maximized) form to just fit in the application window, as I proposed before, and only then calling the ResizeForm procedure.

To the best of my knowledge, it is not possible to have a maximized form (in the normal Windows sense of the word) without a restore button.  Therefore, you either have to live with the presence of the restore button (but there's a way to reduce its impact -- see below), or else use the code I suggested to make the form fill the application window without actually maximizing it.

For what it's worth, there is a way to effectively keep the restore button from actually restoring the form.  You can use a combination of the form's Resize event and the form's Timer event to keep the form from restoring for more than a flashing instant.  The code would be something like this:

'------ start of code ------
Private Sub Form_Resize()

    If WM_apiIsZoomed(Me.hWnd) = 0 Then
        Me.TimerInterval = 1
    End If

End Sub


Private Sub Form_Timer()
    DoCmd.Maximize
    Me.TimerInterval = 0
End Sub
'------ end of code ------

To use the WM_apiIsZoomed API function that is declared in the code you posted, you would have to change its declaration from:

    Private Declare Function WM_apiIsZoomed Lib "user32.dll" Alias "IsZoomed" _
       (ByVal hWnd As Long) As Long

to:

    Public Declare Function WM_apiIsZoomed Lib "user32.dll" Alias "IsZoomed" _
        (ByVal hWnd As Long) As Long

The effect of the above code would be to watch for the form being restored and instantly -- a millisecond later -- maximize it again.

 

Dirk Goldgar, MS Access MVP 2001-2015
Access tips: www.datagnostics.com/tips.html

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated December 16, 2019 Views 1,882 Applies to: