Question Locked

How to get the FONT DPI setting from Windows

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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.

3 replies

by slayer_

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.

This discussion is closed to new replies.