Systemparametersinfo system information acquisition and settings, use with caution

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.