Avatar of JedNebula
JedNebula
Flag for United Kingdom of Great Britain and Northern Ireland asked on

API to find out the currently used display percentage

I am looking for a method where I can find the display percentage used in Windows 7, 8 and 10. I'm fairly sure this is NOT the same as the magnification level. It is making all forms size in a weird way in my projects but I'm finding more and more people are using this feature (especially with Tablets) and so more and more of my forms look strange.

I'm using VB6 and VBA still so I could do with examples formatted for this language.

Below, I have put an image of where you change the setting and you'll see it is not the same as Magnification - a subject for which there seem to be a lot of pages on the web discussing. I think I am unsure of the correct terminology and therefore not finding the pages/solutions I need.

Display.png
Thank you in advance.

Jed
Visual Basic ClassicMicrosoft AccessVBA

Avatar of undefined
Last Comment
Karrtik Iyer

8/22/2022 - Mon
Karrtik Iyer

I think it is called DPI settings in windows, and we have a windows C/C++ API to get the current settings, I think that function is called GetDeviceCaps.
I shall try to give you a VBA code for the same.
ASKER CERTIFIED SOLUTION
Karrtik Iyer

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
JedNebula

ASKER
Perfect - thank you very much.

I was able to ensure that I did a few simple calculations so as more DPIs are added (as Windows 10 already has 175%) I can deal with it...

GetDPIAsDecimal = ((GetDpi * 100) / 96) / 100
GetDPIAsPercent = (GetDpi * 100) / 96
Karrtik Iyer

You are welcome.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23