Getting the screen resolution

E

eagle

How do I get the screen resolution when running an asp.net project. I tried
the old way, and I get an error on the apiGetWindowRect that says "Object
reference not set to an instance of an object. "


Public Structure RECT
Dim x1 As Long
Dim y1 As Long
Dim x2 As Long
Dim y2 As Long
End Structure


Declare Function apiGetDesktopWindow Lib "user32" Alias _
"GetDesktopWindow" () As Long

Declare Function apiGetWindowRect Lib "user32" Alias _
"GetWindowRect" (ByVal hwnd As Long, lpRect As RECT) _
As Long

Function GetScreenResolution () as String
Dim R As new RECT
Dim hWnd As Long
hWnd = apiGetDesktopWindow()
'RetVal = apiGetWindowRect(hWnd, R)
Dim RetVal As Long = apiGetWindowRect(hWnd, R)
GetScreenResolution = (R.x2 - R.x1) & "x" & (R.y2 - R.y1)
End Function
 
M

Marina

That would only help you get the client resolution of the server, which
doesn't really help.

Try looking at the clientHeight and clientWidth properties of the document,
or the body, using javascript.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top