Article ID: 113458
Article Last Modified on 5/6/2003
'
*****************************************************************
' DECLARATIONS SECTION
Option Explicit
Type RECT
x1 As Integer
y1 As Integer
x2 As Integer
y2 As Integer
End Type
Declare Function GetDesktopWindow Lib "User" () As Integer
Declare Function GetWindowRect Lib "User" _
(ByVal hWnd As Integer, rectangle As RECT) As Integer
'
*****************************************************************
' FUNCTION: GetScreenResolution()
'
' PURPOSE:
' To determine the current screen size or resolution.
'
' RETURN:
' The current screen resolution. Typically one of the following:
' 640 x 480
' 800 x 600
' 1024 x 768
'
*****************************************************************
Function GetScreenResolution () as String
Dim R As RECT
Dim hWnd As Integer
Dim RetVal As Integer
hWnd = GetDesktopWindow()
RetVal = GetWindowRect(hWnd, R)
GetScreenResolution = (R.x2 - R.x1) & "x" & (R.y2 - R.y1)
End Function
640x480
Keywords: kbhowto kbprogramming KB113458