Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 25th, 2015, 06:07 AM
Registered User
 
Join Date: Mar 2006
Posts: 9
Thanks: 1
Thanked 1 Time in 1 Post
Default VBA get screen resolution for multiple monitors

I need to get the screen resolution for multiple monitors. This is what I have for 1 monitor, but I'm not sure how I can do this for multiple monitors. I'm using access 2002. It needs to work on windows 2000 -> win 8.1 (if possible)

Code:
Private Declare Function GetSystemMetrics32 Lib "User32" Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long

Public Function ScreenRes() As String
Dim monitor1Width As Long, monitor1Height As Long, noOfMonitors As Integer
    monitor1Width = GetSystemMetrics32(0) ' Monitor1 Height
    monitor1Height = GetSystemMetrics32(1) ' height in points
   
      
    monitor1 = monitor1Width & "x" & monitor1Height
       
    'get number of monitors
    noOfMonitors = GetSystemMetrics32(80)
    
    
    ScreenRes = monitor1
I know I could always use GetSystemMetrics32(78) and GetSystemMetrics32(79) to get the resolution of a virtual monitor, but that if there are more than 2 monitors?

Last edited by asdf; January 25th, 2015 at 06:09 AM..





Similar Threads
Thread Thread Starter Forum Replies Last Post
screen resolution barakros BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 November 11th, 2010 08:50 AM
Screen Resolution ajeesh_online C# 1 June 14th, 2006 12:37 AM
screen resolution Adam H-W Classic ASP Basics 3 October 13th, 2004 09:13 PM
screen resolution miguel.ossa C# 2 October 9th, 2004 11:58 PM
screen resolution mistry_bhavin Pro VB.NET 2002/2003 0 March 13th, 2004 02:36 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.