tbbrhun
asked on
detecting screen resolution in VB.NET
I'd like to find a VB.NET library containing the object that would allow me to detect screen resolution in VB.NET. I'd like to do it with a native VB.NET method, not via VB6 compatibility.
Thanks
Thanks
ASKER
I'm looking for VB.NET solution to this problem. THANKS!
I didn't see that, sorry.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Excellent! THANKS! I can take from here now. THANKS AGAIN!
Public Function gsChkScreenRes()
Dim XTwips As Long
Dim YTwips As Long
Dim XPixels As Long
Dim YPixels As Long
On Error GoTo Syntax_Error
XTwips = Screen.TwipsPerPixelX
YTwips = Screen.TwipsPerPixelY
XPixels = Screen.Height / YTwips
YPixels = Screen.Width / XTwips
gsChkScreenRes = YPixels * XPixels
Exit_Sub:
Exit Function
Syntax_Error:
Resume Exit_Sub
End Function
if it returns <= Mode1 then it's 640x480 and so on.
'Numbers of Colors in palette
Const Mode1 = 307200 '* 640 x 480
Const Mode2 = 480000 '* 800 x 600
Const Mode3 = 786432 '* 1024 x 768
you can add what you need to check
Good luck
Steve