简体   繁体   中英

Is SystemParametersInfo DPI aware?

Specifically, does "result" change in the following code when the DPI is increased via the windows control panel display settings?

UINT result = 0;
if(SystemParametersInfo(SPI_GETFOCUSBORDERHEIGHT, 0, &result, 0) != FALSE)
{
    result = ?;
}

The reason I can't check this myself is that I can't change the DPI setting on the computer I'm working on because the admin has disabled the option.

The documents are unclear but in general the 3rd param is only in/out because the Win32 API here is overloaded as both a getter and a setter. I would not expect this to change on a SET call but on the GET call you have above, yes it will change to indicate the current value. Did you intend to actually post a SET call? The question text implies you are trying to set the value.

For the following code, the value ought not to change:

UINT result = REQUIRED_NEW_VALUE;
if(SystemParametersInfo(SPI_SETFOCUSBORDERHEIGHT, 0, &result, 0) != FALSE)
{
    // result == the same as what was input
}

For the code you posted, result will change from 0 to the current configured value:

UINT result = 0;
if(SystemParametersInfo(SPI_GETFOCUSBORDERHEIGHT, 0, &result, 0) != FALSE)
{
    // result == the current configured value
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM