MS Access Tips: Maximize MS Access Window
65Call this function in autoexec macro for example:
Function AccessMaximize()
AccessMaximize = ShowWindow(GetAccesshWnd(), SW_MAXIMIZE)
End Function
where GetAccesshWnd is defined by:
Function GetAccesshWnd()
Dim hWnd As Integer
Dim hWndAccess As Integer
' Get the handle to the currently active window.
hWnd = GetActiveWindow()
hWndAccess = hWnd
' Find the top window without a parent window.
While hWnd <> 0
hWndAccess = hWnd
hWnd = GetParent(hWnd)
Wend
GetAccesshWnd = hWndAccess
End Function
which uses these declarations:
Declare Function GetActiveWindow Lib "User32" () As IntegerDeclare Function GetParent Lib "User32" (ByVal hWnd As Integer) As IntegerDeclare Function ShowWindow% Lib "User32" (ByVal hWnd%, ByVal nCmdShow%)Global Const SW_MAXIMIZE = 3Global Const SW_SHOWNORMAL = 1Global Const SW_SHOWMINIMIZED = 2





Daniel 8 months ago
Why not simply use:
Access.RunCommand acCmdAppMaximize
or
DoCmd.RunCommand acCmdAppMaximize