Getting the screen resolution

Does VSTGUI provide a function the returns the current screen resolution?

Thank you,
Markus

No. Why do you need to know this?

  1. The user should not be able to select a GUI size for the plugin which is larger than the screen resolution

  2. When the plugin is loaded it automatically sets a size which is comfortable for the user as a default

I would choose a default which works everywhere and let the user choose whatever the user likes, even if it is bigger than the screen resolution of one screen.
VSTGUI has no solution because it is too complex for a plug-in to get right. Just think of the HiDPI mess on Windows with multiple screens. Do you really want to take care of this in your plug-in?

I agree that HiDPI has not been solved well by Microsoft.

Here is the code that i use on Windows. Maybe it helps:

char size = 1;//default  100%
                long maxx = (int)GetSystemMetrics(SM_CXSCREEN);
                long maxy = (int)GetSystemMetrics(SM_CYSCREEN);
                
                HDC screen = GetDC(0);
                int dpiX = GetDeviceCaps(screen, LOGPIXELSX);
                float scaleX = (float)(dpiX) / 96.f;//desktop skaliering auslesen
                int dpiY = GetDeviceCaps(screen, LOGPIXELSY);
                float scaleY = (float)(dpiY) / 96.f;
                ReleaseDC(0, screen);
                
                if ((scaleX != 0) && (scaleY != 0))
                {
                    float guix = 1008;
                    float guiy = 522;
     
                    if (((float)(maxx) / scaleX > guix * 2) && ((float)(maxy) / scaleY > guiy * 2)) size = 5;// 200%
                   
                    return size;
                }