469,927 Members | 1,871 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,927 developers. It's quick & easy.

Access recognising screen Res

Hi all,

I remember seeing somewhere some code that could be used for access to
automatically recognise the screen res of the computer it is being used on.
Anyone know where I can find it easily.

Much appreciated!
Nov 12 '05 #1
2 1419
This is a piece of code I use to see what the resolution is.
Private Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, ByVal
nIndex As Long) As Long
Private Declare Function GetHDC Lib "user32" Alias "GetDC" (ByVal hwnd As
Long) As Long

Public Function GetScreenRes(Optional nGetVal As Integer = 1) As Long
'nGetVal : 1=Width 2=Height 3=Color 32=Dpi

Dim hdc As Long
Dim nIndex as Integer

hdc = GetHDC(hWndAccessApp)

nIndex = 6 + (nGetVal * 2)

GetScreenRes = GetDeviceCaps(hdc, nIndex)
End Function
Regards,
Kevin Rollo
Perth, Western Australia
"Scott" <sm****@ii.net> wrote in message
news:40***********************@freenews.iinet.net. au...
Hi all,

I remember seeing somewhere some code that could be used for access to
automatically recognise the screen res of the computer it is being used on. Anyone know where I can find it easily.

Much appreciated!

Nov 12 '05 #2
Kevin any time you GetDC you must at some point call ReleaseDC.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Kevin Rollo" <ke*@sickofspam.com> wrote in message
news:QB***************@news-server.bigpond.net.au...
This is a piece of code I use to see what the resolution is.
Private Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, ByVal nIndex As Long) As Long
Private Declare Function GetHDC Lib "user32" Alias "GetDC" (ByVal hwnd As Long) As Long

Public Function GetScreenRes(Optional nGetVal As Integer = 1) As Long
'nGetVal : 1=Width 2=Height 3=Color 32=Dpi

Dim hdc As Long
Dim nIndex as Integer

hdc = GetHDC(hWndAccessApp)

nIndex = 6 + (nGetVal * 2)

GetScreenRes = GetDeviceCaps(hdc, nIndex)
End Function
Regards,
Kevin Rollo
Perth, Western Australia
"Scott" <sm****@ii.net> wrote in message
news:40***********************@freenews.iinet.net. au...
Hi all,

I remember seeing somewhere some code that could be used for access to automatically recognise the screen res of the computer it is being
used on.
Anyone know where I can find it easily.

Much appreciated!



Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Scott | last post: by
3 posts views Thread by ferg | last post: by
27 posts views Thread by Wayne | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.