Microsoft KB Archive/240386

= PPT2000: Sample Code to Determine the Windows Display Resolution =

Article ID: 240386

Article Last Modified on 10/11/2006

-

APPLIES TO


 * Microsoft PowerPoint 2000 Standard Edition

-



This article was previously published under Q240386



SUMMARY
This article contains a sample Microsoft Visual Basic for Applications macro (Sub procedure) that demonstrates how to determine the current display resolution.



MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

Sample Visual Basic for Applications Procedure
Option Explicit

Type RECT x1 As Long y1 As Long x2 As Long y2 As Long End Type

' NOTE: The following declare statements are case sensitive.

Declare Function GetDesktopWindow Lib "User32" As Long Declare Function GetWindowRect Lib "User32" _ (ByVal hWnd As Long, rectangle As RECT) As Long

Sub resolution MsgBox GetScreenResolution End Sub

Function GetScreenResolution As String Dim R As RECT Dim hWnd As Long Dim RetVal As Long

hWnd = GetDesktopWindow RetVal = GetWindowRect(hWnd, R)

GetScreenResolution = (R.x2 - R.x1) & "x" & (R.y2 - R.y1)

End Function

