Form, Report.
You can use the hWnd property to determine the handle (a unique Long Integer assigned by Microsoft Windows to the current window.
This property is read-only and is available only in a macro or Visual Basic.
You can use this property in Visual Basic when making calls to Windows Application Programming Interface (API) functions or other external routines that require the hWnd property as an argument Many Windows functions require the hWnd property value of the current window as one of the arguments.
Caution Because the value of this property can change while a program is running, don’t store the hWnd property value in a global variable.
Declare Statement, DoCmd Object, hWndAccessApp Property, Maximum Action.
The following example uses the hWnd property with the Windows Application Programming Interface (API) IsZoomed function to determine if a window is maximized.
' Enter on single line in Declarations section of Module window.Function IsZoomed Lib "USER32" (ByVal hWnd As Long) As Integer Form_Activate() Dim intWindowHandle As Long intWindowHandle = Screen.ActiveForm.hWnd If Not IsZoomed(intWindowHandle) Then DoCmd.Maximize End IfSub