1

I am frequently playing games and though I have a good graphics card, it's not capable of running all games in 4K on my 4K monitor. Since I run all my games in borderless windowed mode, I first have to reduce the monitor resolution down to 1080p before starting the game, and I'm trying to automate this.

I have already created a program that is capable of doing this, but I need to hardcode in a few big strings that are some kind of identifier. The way the program operates is that it first:

  1. Modifies the registry key HKCU\Control Panel\Desktop\PerMonitorSettings\<big id here> and set a key beneath it to lock in the font size
  2. Uses ChangeDisplaySettingsEx to make the resolution and positioning change to the monitor, this has the extra benefit of refreshing the monitor setting from the registry, and reacting to my registry change in point 1

Now, I have two questions but I'll concentrate on one of them here, and that question is this:

Given the device name (id?) \\.\DISPLAY1, is there a way to set the font size of that monitor without monkeying around in that registry key? I can't find a corresponding setting in the DEVMODE or DISPLAY_DEVICE structs that I am already using, and when trying to search for it using Google I can only find ways to make my own software DPI aware, which is not what I want.

I tried using EnumDisplayDevices, and it gives me some device id's and another registry key but I can't find anything in that structure that would let me even read the current font size.

I basically like a programmatical way to change my monitor between 4K @ 200% size and 1080p @ 100% size.

Lasse V. Karlsen
  • 380,855
  • 102
  • 628
  • 825
  • My other question, that will be posted if this one doesn't turn up anything, is how I can get from `\\\\.\\DISPLAY1` to the registry ID which looks like this: `ACI28A7160556_05_07E2_B0^F25449DC7608FE090234D904F136BDB2` without hardcoding it, I haven't found a way to discover this long ID from C#. – Lasse V. Karlsen Nov 11 '20 at 15:32
  • not related to your question, but I am curious: why don't you just use fullscreen? – bolov Nov 11 '20 at 15:45
  • you might try and look into autohotkey. It might be able to do this. – bolov Nov 11 '20 at 15:48
  • You might have a look at the other `EnumDisplay*` functions in user32.dll. There's also this answer which might give you some pointers: https://stackoverflow.com/a/10303610/70345 (the comments on the question itself may also prove useful). – Ian Kemp Nov 11 '20 at 15:58
  • @bolov Because I love to be able to simply move the mouse cursor over to one of the other monitors I have to control webpages and discord etc. without having to alt-tab out of the game. – Lasse V. Karlsen Nov 11 '20 at 16:08

0 Answers0