Screen resolution

G

Guest

I've recently experienced a problem in an Access application I have
developed. I stumbled on a user that uses this application on a compter set
to a different screen resolution that the others.

The problem is that I have so MoveSize actions in my VBA code and it has a
different effect on this user's computer because of the different screen
resolution.

Would any of you know how I could verify the screen resolution of the user
and determine my MoveSize actions depending on the setting?

Thanks for any lead you can give me!
 
P

Pieter Wijnen

I do <g>, If I missed out some declares please google "name" API vb
This one centers Access size 1024x768

HtH

Pieter

Public Const WU_SW_RESTORE = 9

Public Type WU_RECT
x1 As Long
y1 As Long
x2 As Long
y2 As Long
End Type

Public Declare Function IsZoomed Lib "user32" (ByVal hWnd As Long) As Long
Public 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
Public Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal
NewState As Long) As Long
Public Declare Function GetClientRect Lib "user32" (ByVal hWnd As Long,
ByRef R As WU_RECT) As Long
Public Declare Function GetDesktopWindow Lib "user32" () As Long

Public Function SetAccessSize(Optional ByVal dx As Long = 1024, Optional
ByVal dy As Long = 768) As Long
' Set Size of Access & Center on Screen
Const x = 0, Y = 0
Dim hWnd As Long, F As Long
Dim RDesk As WU_RECT

On Local Error Resume Next

hWnd = Applicatauion.hwndAccessApp
If (IsZoomed(hWnd)) Then
ShowWindow hWnd, WU_SW_RESTORE
End If
GetWindowRect GetDesktopWindow(), RDesk
If ((RDesk.x2 - RDesk.x1) - (dx - x) < 0) Or ((RDesk.y2 - RDesk.y1) -
(dy - Y)) < 0 Then
' Screen Size To Small
MoveWindow hWnd, RDesk.x1, RDesk.y1, RDesk.x2, RDesk.y2, True
F = False
Else
MoveWindow hWnd, RDesk.x1 + ((RDesk.x2 - RDesk.x1) - dx) / 2, RDesk.y1 +
((RDesk.y2 - RDesk.y1) - dy) / 2, dx, dy, True
F = True
End If
SetAccessSize = F
End Function
 
J

James A. Fortune

Gaetan said:
Would any of you know how I could verify the screen resolution of the user
and determine my MoveSize actions depending on the setting?

Take a look at the API function GetDeviceCaps in the Win32 help file to
verify the screen resolution.

James A. Fortune
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top