Systemparametersinfo (...) can be used in MFC (......) Function to obtain and set system information, as shown in the following example, the height of the System menu bar is changed.
Example: Change the height of the System Menu Bar
Nonclientmetrics NCM;
NCM. cbsize = sizeof (nonclientmetrics); // This is very important. Otherwise, the following function call returns 0, I .e., ret = 0, indicating that the function call fails.
Int ret = ::Systemparametersinfo (SPI _GetNonclientmetrics, sizeof (nonclientmetrics), & NCM, 0 );
// Cstring STR;
// Str. Format ("Return Value: % d, % d", RET, NCM. imenuheight );
// Afxmessagebox (STR );
NCM. imenuheight + = 10; // set the system menu height to 1
Ret = ::Systemparametersinfo (SPI _SetNonclientmetrics, sizeof (nonclientmetrics), & NCM, 0 );
// Ret =: systemparametersinfo (spi_setnonclientmetrics, sizeof (nonclientmetrics), & NCM, spif_sendchange );
// The last parameter is 0 or spif_sendchange. The latter indicates that the change will be written to update win. ini.
// Str. Format ("Return Value: % d, % d", RET, NCM. imenuheight );
// Afxmessagebox (STR );
It is worth noting that if you want to use it to set the applicationProgramPlease be careful with the relevant properties, because it changes the properties of the operating system, that is, the properties of other applications on the system will also be changed.
It can be used to obtain information about the system, such as the screen width, height, menu bar, and Title Bar Height.