Chimaera Posted February 9, 2011 Share Posted February 9, 2011 ok i did myself a resolution one a while ago but im trying to contain it within a function so i can just add at bottom of code and call when needed expandcollapse popupGlobal $resolution MsgBox(0,"Desktop Resolution", _Desktop_Resolution() & " @ " & @DesktopRefresh & " Hertz") Func _Desktop_Resolution() If @DesktopWidth = 640 And @DesktopHeight = 480 Then $resolution = "640 x 480 (4:3) VGA" ElseIf @DesktopWidth = 800 And @DesktopHeight = 600 Then $resolution = "800 x 600 (4:3)(12:9) SVGA" ElseIf @DesktopWidth = 1024 And @DesktopHeight = 768 Then $resolution = "1024 x 768 (4:3) XGA" ElseIf @DesktopWidth = 1152 And @DesktopHeight = 864 Then $resolution = "1152 x 864 (4:3) XGA+" ElseIf @DesktopWidth = 1280 And @DesktopHeight = 720 Then $resolution = "1280 x 720 (16:9) HD Ready" ElseIf @DesktopWidth = 1280 And @DesktopHeight = 768 Then $resolution = "1280 x 768 (5:3)(15:9) WXGA" ElseIf @DesktopWidth = 1280 And @DesktopHeight = 800 Then $resolution = "1280 x 800 (8:5)(16:10) WXGA" ElseIf @DesktopWidth = 1280 And @DesktopHeight = 960 Then $resolution = "1280 x 960 (4:3) SXGA" ElseIf @DesktopWidth = 1280 And @DesktopHeight = 1024 Then $resolution = "1280 x 1024 (5:4) SXGA" ElseIf @DesktopWidth = 1366 And @DesktopHeight = 768 Then $resolution = "1366 x 768 (16:9) Basic HD" ElseIf @DesktopWidth = 1440 And @DesktopHeight = 900 Then $resolution = "1440 x 900 (8:5)(16:10) WSXGA" ElseIf @DesktopWidth = 1600 And @DesktopHeight = 900 Then $resolution = "1600 x 900 (16:9) HD +" ElseIf @DesktopWidth = 1600 And @DesktopHeight = 1200 Then $resolution = "1600 x 1200 (4:3) UXGA" ElseIf @DesktopWidth = 1680 And @DesktopHeight = 1050 Then $resolution = "1680 x 1050 (8:5)(16:10) WSXGA +" ElseIf @DesktopWidth = 1920 And @DesktopHeight = 1080 Then $resolution = "1920 x 1080 (16:9) Full HD" ElseIf @DesktopWidth = 1920 And @DesktopHeight = 1200 Then $resolution = "1920 x 1200 (8:5)(16:10) WUXGA" Else MsgBox(16, "Error", "Unsupported Resolution") Exit EndIf EndFunc This is what i have but it dosent find the $resolution bit now, how can i fix it so i can just call the _Desktop_Resolution() and get what the resolution is? or have missed something obvious? If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
jvanegmond Posted February 9, 2011 Share Posted February 9, 2011 Like this: expandcollapse popupMsgBox(0,"Desktop Resolution", _Desktop_Resolution() & " @ " & @DesktopRefresh & " Hertz") Func _Desktop_Resolution() Local $resolution = "" If @DesktopWidth = 640 And @DesktopHeight = 480 Then $resolution = "640 x 480 (4:3) VGA" ElseIf @DesktopWidth = 800 And @DesktopHeight = 600 Then $resolution = "800 x 600 (4:3)(12:9) SVGA" ElseIf @DesktopWidth = 1024 And @DesktopHeight = 768 Then $resolution = "1024 x 768 (4:3) XGA" ElseIf @DesktopWidth = 1152 And @DesktopHeight = 864 Then $resolution = "1152 x 864 (4:3) XGA+" ElseIf @DesktopWidth = 1280 And @DesktopHeight = 720 Then $resolution = "1280 x 720 (16:9) HD Ready" ElseIf @DesktopWidth = 1280 And @DesktopHeight = 768 Then $resolution = "1280 x 768 (5:3)(15:9) WXGA" ElseIf @DesktopWidth = 1280 And @DesktopHeight = 800 Then $resolution = "1280 x 800 (8:5)(16:10) WXGA" ElseIf @DesktopWidth = 1280 And @DesktopHeight = 960 Then $resolution = "1280 x 960 (4:3) SXGA" ElseIf @DesktopWidth = 1280 And @DesktopHeight = 1024 Then $resolution = "1280 x 1024 (5:4) SXGA" ElseIf @DesktopWidth = 1366 And @DesktopHeight = 768 Then $resolution = "1366 x 768 (16:9) Basic HD" ElseIf @DesktopWidth = 1440 And @DesktopHeight = 900 Then $resolution = "1440 x 900 (8:5)(16:10) WSXGA" ElseIf @DesktopWidth = 1600 And @DesktopHeight = 900 Then $resolution = "1600 x 900 (16:9) HD +" ElseIf @DesktopWidth = 1600 And @DesktopHeight = 1200 Then $resolution = "1600 x 1200 (4:3) UXGA" ElseIf @DesktopWidth = 1680 And @DesktopHeight = 1050 Then $resolution = "1680 x 1050 (8:5)(16:10) WSXGA +" ElseIf @DesktopWidth = 1920 And @DesktopHeight = 1080 Then $resolution = "1920 x 1080 (16:9) Full HD" ElseIf @DesktopWidth = 1920 And @DesktopHeight = 1200 Then $resolution = "1920 x 1200 (8:5)(16:10) WUXGA" Else Return SetError(1, 0, $resolution) EndIf Return $resolution EndFunc github.com/jvanegmond Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now