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
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