Stuart McLachlan
stuart at lexacorp.com.pg
Sat Feb 25 19:11:12 CST 2012
Not truly Maximized, but a similar effect: Put the following code in a module and replace "Docmd.Maximize" in your Load/Activate event with: "MaximizeRestoredForm Me" Also set the forms "MinMax Buttons" property to None. -- Stuart '*************************** Code Start ************************ Option Compare Database Option Explicit 'This code was originally written by Terry Kreft. 'It is not to be altered or distributed, 'except as part of an application. 'You are free to use it in any application, 'provided the copyright notice is left unchanged. ' 'Code courtesy of 'Terry Kreft ' 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. 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 ************************ -- Stuart On 25 Feb 2012 at 14:40, Rocky Smolin wrote: > I need to do it under program control. While developing I need those > buttons. But when I distribute the mde I'd like them off. I can easily > detect if the file's an mde but don't know the code to turn them off. The > control are in the property list for Me. But don't seem to want to compile. > > R > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust > Sent: Saturday, February 25, 2012 12:03 PM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Disable minimize, restore, close buttons > > Off the top of my head, what about making the forms modal? > > Charlotte Foust > > On Sat, Feb 25, 2012 at 11:45 AM, Rocky Smolin > <rockysmolin at bchacc.com>wrote: > > > Dear List: > > > > Now that I think I have that problem with the maximizing and centering > > of forms on 2010 under control (somewhat) I think I should disable the > > minimize, restore, and close buttons if I'm working with an mde. > > > > I have code that checks to see if I'm working with an mde and does > > stuff so I could add the disables to that. However, I can't seem to > > find the right syntax. Does <file://\\Does> anyone know that? > > > > MTIA > > > > Rocky Smolin > > Beach Access Software > > 858-259-4334 > > www.bchacc.com > > > > <http://www.bchacc.com/ > > > > > > > www.e-z-mrp.com > > > > <http://www.e-z-mrp.com/ > > > > > > > Skype: rocky.smolin > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > > > > > Website: http://www.databaseadvisors.com > > > > > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com >