Option Compare Database
Option Explicit
Declare Function apiGetActiveWindow Lib "user32" Alias "GetActiveWindow" () As Long
Declare Function apiGetParent Lib "user32" Alias "GetParent" (ByVal hWnd As Long) As Long
Declare Function apiMoveWindow Lib "user32" Alias "MoveWindow" _
(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
Function AccessMoveSize(iX As Integer, iY As Integer, iWidth As _
Integer, iHeight As Integer)
apiMoveWindow GetAccesshWnd(), iX, iY, iWidth, iHeight, True
End Function
Function GetAccesshWnd()
Dim hWnd As Long
Dim hWndAccess As Long
' Get the handle to the currently active window.
hWnd = apiGetActiveWindow()
hWndAccess = hWnd
' Find the top window (which has no parent window).
While hWnd <> 0
hWndAccess = hWnd
hWnd = apiGetParent(hWnd)
Wend
GetAccesshWnd = hWndAccess
End