ajetrumpet
Banned
- Local time
- Today, 05:50
- Joined
- Jun 22, 2007
- Messages
- 5,638
Here is some code that will enable you to position and size the Microsoft Access Window accordingly.
Declarations Section:
Functions to Use:
Call the function to move and size the window with:
The only time I have personally used this function is when I wanted to completely hide and disable the MS Access window from being viewed. Combining the above code with "check screen resolution" code will move the access window off the screen so it is inaccessible to users. For example, to reduce the size of the window to 0 length x 0 width, and move it off the screen to the right-hand side for a computer with a screen resolution of 1024 x 768, call the above function with:
This code does not apply to multiple monitor setups. I have attached an illustration of checking the screen resolution and using these functions to move the access window off the right side of the screen. Any comments welcome.
Declarations Section:
Code:
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
Declare Function apiGetActiveWindow Lib "User32" Alias "GetActiveWindow" () As Long
Declare Function apiGetParent Lib "User32" Alias "GetParent" (ByVal hWnd As Long) As Long
Code:
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
hWnd = apiGetActiveWindow()
hWndAccess = hWnd
While hWnd <> 0
hWndAccess = hWnd
hWnd = apiGetParent(hWnd)
Wend
GetAccesshWnd = hWndAccess
End Function
Code:
Call AccessMoveSize('X' axis pos, 'Y' axis pos, Width, Height)
Code:
Call AccessMoveSize(1024, 0, 0, 0)