|
|
|
'' http://support.microsoft.com/kb/q148395/ '' ACC: How to Determine the Current Screen Resolution (95/97) '' Last accessed: 2004-04-02, ANW Option Explicit ''***************************************************************** '' DECLARATIONS SECTION ''***************************************************************** 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 ''***************************************************************** '' 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 Long
Dim RetVal As Long
hWnd = GetDesktopWindow()
RetVal = GetWindowRect(hWnd, R)
GetScreenResolution = (R.x2 - R.x1) & "x" & (R.y2 - R.y1)
End Function
|
.
Published: 02-Apr-2005
Last edited:
01-Mar-2011 20:51