How do I get the screen resolution?
Mike Parker
aldacron at gmail.com
Thu Apr 28 11:35:46 UTC 2022
On Thursday, 28 April 2022 at 11:22:15 UTC, Alexander Zhirov
wrote:
> Are there any methods to get the screen resolution?
> On C/C++ from under X11, it is not possible to do this on the
> command line via SSH, since the display is not defined. And is
> it possible to do this somehow by means of D, pulling out the
> system resolution of the installed display?
Like C++, the D standard library doesn't have anything for this.
It's platform specific. There are several open source libraries
out there that include that functionality, so you could just look
at one of them (GLFW, SDL, SFML, etc.) and do what they do for
the platforms you care about. They all have to go through the
same system APIs. For example, on Windows you can use two calls
to `GetSystemMetrics` (one for the width, one for the height).
(https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getsystemmetrics)
More information about the Digitalmars-d-learn
mailing list