In my project, I have three different userforms to display, optimized for three different aspect ratios. I need my code to call the screen resolution of the user’s monitor, then check to see which category it belongs to, and finally choose the appropriate userform.
I’ve gotten as far as categorizing, but I’m self-taught and have been using absolutely horrendous code. I’ve just taken every aspect ratio available on our machines and put it into an
if then statement; when the correct if statement is triggered, it populates the variable
I’m absolutely certain there’s a better way to do this. I would like to;
- find a mathematical way to represent a “range” of ratios, as not every resolution in the 16:9 category, for example, is exactly 16/9, and
- clean up the validation system that picks the right category for the user’s setup. Possibly an array or a
Declare Function getsystemmetrics32 Lib "User32" _ Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long Sub callAspectRatio() Dim w As Long Dim h As Long Dim Asp As String w = getsystemmetrics32(0) h = getsystemmetrics32(1) If w = 1920 And h = 1080 Then Asp = "16:9" If w = 1680 And h = 1050 Then Asp = "16:9" If w = 1600 And h = 900 Then Asp = "16:9" If w = 1366 And h = 768 Then Asp = "16:9" If w = 1360 And h = 768 Then Asp = "16:9" If w = 1280 And h = 720 Then Asp = "16:9" If w = 1280 And h = 600 Then Asp = "16:9" If w = 1440 And h = 900 Then Asp = "8:5" If w = 1280 And h = 1024 Then Asp = "8:5" If w = 1280 And h = 960 Then Asp = "8:5" If w = 1600 And h = 1200 Then Asp = "4:3" If w = 1400 And h = 1050 Then Asp = "4:3" If w = 1280 And h = 1024 Then Asp = "4:3" If w = 1280 And h = 960 Then Asp = "4:3" If w = 1152 And h = 864 Then Asp = "4:3" If w = 1024 And h = 768 Then Asp = "4:3" If w = 800 And h = 600 Then Asp = "4:3" MsgBox Asp End Sub
✓ Extra quality
ExtraProxies brings the best proxy quality for you with our private and reliable proxies
✓ Extra anonymity
Top level of anonymity and 100% safe proxies – this is what you get with every proxy package
✓ Extra speed
1,ooo mb/s proxy servers speed – we are way better than others – just enjoy our proxies!
USA proxy location
We offer premium quality USA private proxies – the most essential proxies you can ever want from USA
Our proxies have TOP level of anonymity + Elite quality, so you are always safe and secure with your proxies
Use your proxies as much as you want – we have no limits for data transfer and bandwidth, unlimited usage!
Superb fast proxy servers with 1,000 mb/s speed – sit back and enjoy your lightning fast private proxies!
99,9% servers uptime
Alive and working proxies all the time – we are taking care of our servers so you can use them without any problems
No usage restrictions
You have freedom to use your proxies with every software, browser or website you want without restrictions
Perfect for SEO
We are 100% friendly with all SEO tasks as well as internet marketing – feel the power with our proxies
Buy more proxies and get better price – we offer various proxy packages with great deals and discounts
We are working 24/7 to bring the best proxy experience for you – we are glad to help and assist you!