How Disable close button on maximized form? 
Author Message
 How Disable close button on maximized form?

I have disabled the close button on my form but it is enabled if the
form is maximized.
How can I solve the problem?

Bye, Fabrizio Maricotti



Sun, 20 Aug 2000 03:00:00 GMT  
 How Disable close button on maximized form?

I don't know what version you are using but in 97 its simple.
Control box- YES
Min Max Buttons- Both
Close Button- No
sure it shows the close button but it does not work.
you can get rid of all the button at the top by setting control box to
NO, then create a button that will close the form using the wizard.

Bill

Quote:

> I have disabled the close button on my form but it is enabled if the
> form is maximized.
> How can I solve the problem?

> Bye, Fabrizio Maricotti



Sun, 20 Aug 2000 03:00:00 GMT  
 How Disable close button on maximized form?

Hi,

You could try doing something like this.

Create a boolean variable at form level.(call it mboolClose)
Private mboolClose as integer

At Form Open, set it to False.
mboolClose=False

Put the following code behind form's OnUnload event,
Private Sub Form_Unload(Cancel As Integer)
        Cancel=Not mboolclose
End Sub

Behind the Exit button that you created on the form, add the following line
mboolclose=True

This hopefully should stop users from closing the form through any other
means except your Exit button.

HTH
--
Just my $.001
Dev Ashish
---------------
The Access Web ( http://home.att.net/~dashish )
---------------

:I have disabled the close button on my form but it is enabled if the
:form is maximized.
:How can I solve the problem?
:
:Bye, Fabrizio Maricotti
:



Mon, 21 Aug 2000 03:00:00 GMT  
 How Disable close button on maximized form?

In Access97 you can use the following

To use the code put it in a module and call it as indicated below.
===============================
What the code does is resize the form to fit inside the Access window
exactly without actually maximizing it.

The method is not perfect:
    1) you have to set the form to have no border to get the best effect
    2) If you resize Access the form will not automatically resize with it,
as a maximized form does.

To call the code, in the form load event use the following call
    MaximizeRestoredForm Me

'************** Code Start *************************
  Type Rect
    x1 As Long
    y1 As Long
    x2 As Long
    y2 As Long
  End Type

  Declare Function IsZoomed Lib "user32" (ByVal hwnd As Long) As Long
  Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal _
         nCmdShow As Long) As Long
  Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal _
         X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight _
         As Long, ByVal bRepaint As Long) As Long
  Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
'Use following instead of GetWindowRect
  Declare Function GetClientRect Lib "user32" (ByVal hwnd As Long, lpRect
As Rect) As Long

  Public Const SW_MAXIMIZE = 3
  Public Const SW_SHOWNORMAL = 1

Sub MaximizeRestoredForm(F As Form)
  Dim MDIRect As Rect
  ' If the form is maximized, restore it.
  If IsZoomed(F.hwnd) <> 0 Then
    ShowWindow F.hwnd, SW_SHOWNORMAL
  End If
  ' Get the screen coordinates and window size of the
  ' MDIClient area.
'This is the line which is different
  GetClientRect GetParent(F.hwnd), MDIRect
  ' Move the form to the upper left corner of the MDIClient
  ' window (0,0) and size it to the same size as the
  ' MDIClient window.
  MoveWindow F.hwnd, 0, 0, MDIRect.x2 - MDIRect.x1, MDIRect.y2 -
MDIRect.y1, True
End Sub
'************** Code End ***************************

Quote:

>I have disabled the close button on my form but it is enabled if the
>form is maximized.
>How can I solve the problem?

>Bye, Fabrizio Maricotti



Mon, 21 Aug 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Disabling close button on maximized form - How?

2. Disable close button on maximized forms

3. Disable Close, Restore Buttons on Maximized Form

4. How to hide the maximize/restore and close-button on a maximized form

5. How to hide the maximize/restore and close-button on a maximized form

6. Disable Access Close Button not Form Close Button?

7. How to disable the Minimize, Maximize and Close buttons

8. DISABLE close button when MAXIMIZE?

9. DISABLE close button when MAXIMIZE?

10. Disable the close button when maximized


 
Powered by phpBB® Forum Software © phpBB Group