How to get the FONT DPI setting from Windows

By Slayer_ ·
Language is VB6
I can't seem to find on Google any good examples of this.

Some of the forums and stuff I found said that "GetDeviceCaps" was the solution I want, but I can't find much documentation that explains it well.

What I want to know, is the current font DPI setting, is it at 96 or something else?

The reason is if it is not at 96, some of the proprietary visual controls on our forms will crash so hard it takes down Windows with it. Obviously this is a serious problem, especially in this modern age of IT people feeling that everyone should be running 1600 x 1200 resolution even if the user is legally blind...

So I want to be able to detect if the setting is not at 96, and if not, cough up an error and have the program refuse to run until the DPI setting is fixed.

How can I do this, Google doesn't seem to want to give me the answers I want (Perhaps I am asking the wrong questions?)

Code examples would be nice. Thanks.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

This should do you

by Tony Hopkinson In reply to How to get the FONT DPI s ...
Collapse -

That looks good

by Slayer_ In reply to This should do you

a22% = GetDeviceCaps(hDC%, LOGPIXELSX)
Print "(LOGPIXELSX)", "Horizontal dots per inch:", a22%
a23% = GetDeviceCaps(hDC%, LOGPIXELSY)
Print "(LOGPIXELSY)", "Vertical dots per inch:", a23%

I saw that pages, but didn't know that was the option I wanted, thanks.

Related Discussions

Related Forums