Crea un módulo nuevo y escriba las Declaraciones y función siguientes:

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

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

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

Y llama a la función de la siguiente forma:

GetScreenResolution()

Fuente: www.microsoft.com

Leave a Reply