How to get the ratio of 'display scale and layout'?

The secondary monitor of our computer was set by my colleague like this:
Win10 settings → display → scale and layout → 300%(recommended)
And I was not allowed to reset the ratio from 300% to 100%, but I hope to show my images with 100% scale。What should I do in my GLFW codes?

On the Windows platform the content scale will only alter the size of the GLFW Window if the GLFW_SCALE_TO_MONITOR window hint is set, the default for which is off. See:
https://www.glfw.org/docs/3.3/window_guide.html#window_scale

Additionally, on Windows the framebuffer size (pixel size) and window size (screen coordinates) are the same.

So if you want to display your images with 100% scale then simply draw them as you normally would - i.e. you don’t need any code to be changed to achieve this.

It didn’t work. My images were still shown with 300% scale unless I set the Win10’s ‘display scale and layout’ to 100%. Is it because I didn’t create the window in a right way? Here are my codes in the main thread:
(graphic card: nVidia Rtx 2080 super)

int MonitorNum;
GLFWwindow* window1;
GLFWmonitor** pMonitors;
int ret = glfwInit();
if (!ret)
{
AfxMessageBox(“GLFW Init failed”, MB_OK | MB_ICONSTOP);
return -1;
}

glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 4);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_COMPAT_PROFILE);
pMonitors = glfwGetMonitors(&MonitorNum);

int width_mm, height_mm;
glfwGetMonitorPhysicalSize(pMonitors[1], &width_mm, &height_mm);
moninfo[1].width_cm = width_mm / 10.0;
moninfo[1].height_cm = height_mm / 10.0;
const GLFWvidmode* mode = glfwGetVideoMode(pMonitors[1]);
moninfo[1].height_pixel = mode->height;
moninfo[1].width_pixel = mode->width;
moninfo[1].redbits = mode->redBits;
moninfo[1].bluebits = mode->blueBits;
moninfo[1].greenbits = mode->greenBits;
moninfo[1].refrate = mode->refreshRate;
glfwGetMonitorPos(pMonitors[1], &moninfo[1].virtualPos[0], &moninfo[1].virtualPos[1]);

glfwWindowHint(GLFW_RED_BITS, moninfo[1].redbits);
glfwWindowHint(GLFW_GREEN_BITS, moninfo[1].bluebits);
glfwWindowHint(GLFW_BLUE_BITS, moninfo[1].greenbits);
glfwWindowHint(GLFW_DOUBLEBUFFER, TRUE);
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
glfwWindowHint(GLFW_DECORATED, GLFW_FALSE);
glfwWindowHint(GLFW_SAMPLES, MULTISAMPLEN);
glfwWindowHint(GLFW_FOCUSED, GLFW_FALSE);
glfwWindowHint(GLFW_FLOATING, GLFW_TRUE);
glfwWindowHint(GLFW_CENTER_CURSOR, GLFW_FALSE);
glfwWindowHint(GLFW_AUTO_ICONIFY, GLFW_FALSE);
glfwWindowHint(GLFW_SCALE_TO_MONITOR,TRUE);
window1 = glfwCreateWindow(moninfo[1].width_pixel, moninfo[1].height_pixel, “Hello”, NULL, NULL);
glfwSetWindowMonitor(window1, pMonitors[1], moninfo[1].virtualPos[0], moninfo[1].virtualPos[1],
moninfo[1].width_pixel, moninfo[1].height_pixel, moninfo[1].refrate);

And for the render thread:

glfwMakeContextCurrent(window1);
glewExperimental = true;
int initcode = glewInit();
glViewport(0, 0, moninfo[1].width_pixel, moninfo[1].height_pixel);

I think you may have misunderstood what I meant when I stated:

I meant that you should NOT set glfwWindowHint(GLFW_SCALE_TO_MONITOR,TRUE); ,i.e. remove that line of code.

However this will not change your application since after creating your window you call glfwSetWindowMonitor with a non NULL monitor which should create a fullscreen window.

As to why your images are now shown with 300% scale I can’t tell from your code since you are not showing the image display code. If your image is X pixels by Y pixels in size and you render it that size you should get the same size of image no matter what the Windows scale and layout is.

I find the bug now. I mistakenly acquired size (in pixel) from video mode:
moninfo[1].height_pixel = mode->height
The correct way is to use glfwGetFrameBufferSize.