SetResolution
SetResolution copied to clipboard
Feature request: Desktop scaling
Would be cool if the program could handle scaling as well.
FYI: This is what I use for scaling:
# https://stackoverflow.com/a/68215326/4982408
function Set-Scaling {
# Posted by IanXue-MSFT on
# https://learn.microsoft.com/en-us/answers/questions/197944/batch-file-or-tool-like-powertoy-to-change-the-res.html
# $scaling = 0 : 100% (default)
# $scaling = 1 : 125%
# $scaling = 2 : 150%
# $scaling = 3 : 175%
param($scaling)
$source = @'
[DllImport("user32.dll", EntryPoint = "SystemParametersInfo")]
public static extern bool SystemParametersInfo(
uint uiAction,
uint uiParam,
uint pvParam,
uint fWinIni);
'@
$apicall = Add-Type -MemberDefinition $source -Name WinAPICall -Namespace SystemParamInfo -PassThru
$apicall::SystemParametersInfo(0x009F, $scaling, $null, 1) | Out-Null
}
Set-Scaling -scaling 0
You can comment out the last line and call this from another script by naming it as a .pm1 file and then using code like this in another script:
import-module .\powershell_modules\set-resolution.psm1
Set-Scaling -scaling 2
Note that he numbers (0, 1, 2) don't always line up with the % listed in the comments. This appears to be system dependent. You may even have to use negative numbers on some systems, which is detailed in the Microsoft link.
I took a look at this some time ago and I couldn't get anything consistent out of this API. From what I found out the scaling is system dependent so there's no direct way to specify a precise scale mode without a bunch of experimentation. Even on my system with multiple monitors the numbers were wildly different between the two monitors.
Hello Everyone. i have a little problem with DPI/scalling. after restart PC dpi is set to - for example - 150% instead of 100. Anyone have problem like this ?