Antinsh said:
To David:
The purpose of this for me is to set Access window in lower half of
desktop
and put my application in upper half so that they both could be seen at
the
same time.
Here's a (standard) module I use to see how apps look at lower screen rez.
It sizes the Access window and centers it on screen. I realize you want to
locate it differently, but it shouldn't be too hard to figure out. Just how
you handle this from the .net side of things is up to you. I don't do .net
''' BEGIN CODE '''
Option Compare Database
Option Explicit
'
Private Type Rect
x1 As Long
y1 As Long
x2 As Long
y2 As Long
End Type
'
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function GetWindowRect Lib "user32" _
(ByVal hWnd As Long, r As Rect) As Long
Private Declare Function IsZoomed Lib "user32" _
(ByVal hWnd As Long) As Long
Private Declare Function MoveWindow Lib "user32" _
(ByVal hWnd As Long, ByVal X As Long, ByVal Y As Long, _
ByVal dx As Long, ByVal dy As Long, ByVal fRepaint As Long) As Long
Private Declare Function ShowWindow Lib "user32" _
(ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Sub SizeAccess(ByVal dx As Long, ByVal dy As Long)
'Set size of Access and center on Desktop
Const SW_RESTORE As Long = 9
Dim h As Long
Dim r As Rect
'
On Error Resume Next
'
h = Application.hWndAccessApp
'If maximised, restore
If (IsZoomed(h)) Then ShowWindow h, SW_RESTORE
'
'Get available Desktop size
GetWindowRect GetDesktopWindow(), r
If ((r.x2 - r.x1) - dx) < 0 Or ((r.y2 - r.y1) - dy) < 0 Then
'Desktop smaller than requested size
'so size to Desktop
MoveWindow h, r.x1, r.y1, r.x2, r.y2, True
Else
'Adjust to requested size and center
MoveWindow h, _
r.x1 + ((r.x2 - r.x1) - dx) \ 2, _
r.y1 + ((r.y2 - r.y1) - dy) \ 2, _
dx, dy, True
End If
End Sub
''' END CODE '''
As usual, watch out for line-wrap...