472,119 Members | 1,698 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

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 1470
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
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.