Article ID: 141111
Article Last Modified on 1/19/2007
'=================================================================
'Module Declarations section
'=================================================================
Option Compare Database
Option Explicit
Declare Function IsZoomed Lib "User32" (ByVal hWnd As Long) As _
Integer
Declare Function IsIconic Lib "User32" (ByVal hWnd As Long) As _
Integer
'===================================================================
'Property Maximized
'
'This procedure uses the Property Get statement to define the custom
'form property 'Maximized' by calling the IsZoomed() function.
'
'Return Value:
' True(-1) - The form is maximized.
' False(0) - The form is not maximized.
'
'====================================================================
Public Property Get Maximized() As Integer
Maximized = IsZoomed(Me.hWnd) * -1
End Property
'====================================================================
'Property Minimized
'
'This procedure uses the Property Get statement to define the custom
'form property 'Minimized' by calling the IsIconic() function.
'
'Return Value:
' True(-1) - The form is minimized.
' False(0) - The form is not minimized.
'
'====================================================================
Public Property Get Minimized() As Integer
Minimized = IsIconic(Me.hWnd) * -1
End Property
'===================================================================
'Property Maximized
'
'This procedure uses the Property Let statement to set the value of
'the custom form property 'Maximized'. The IsMax argument must be
'defined as the same data type returned by the corresponding Property
'Get procedure for the same custom property.
'
'====================================================================
Public Property Let Maximized(IsMax As Integer)
If IsMax Then
Me.SetFocus
DoCmd.Maximize
Else
Me.SetFocus
DoCmd.Restore
End If
End Property
'====================================================================
'Property Minimized
'
'This procedure uses the Property Let statement to set the value of
'the custom form property 'Minimized'. The IsMin argument must be
'defined as the same data type returned by the corresponding Property
'Get procedure for the same custom property.
'
'====================================================================
Public Property Let Minimized(IsMin As Integer)
If IsMin Then
Me.SetFocus
DoCmd.Minimize
Else
Me.SetFocus
DoCmd.Restore
End If
End Property?Forms!Customers.Maximized
Type Forms!Customers.Maximized=True
Forms!Customers.Minimized=True
Keywords: kbhowto kbprogramming kbusage KB141111