Windows API one-day training (75) systemparametersinfo Function

Source: Internet
Author: User
Windows API one-day training (75) systemparametersinfo Function

In the face of the gorgeous windows desktop, I may feel a lot better at work, but I will always lose interest after a long time, and I always want to update the desktop images on a regular basis. How do software developers need to meet such requirements? Try to find the API function. So far, there have been a lot of software for changing desktop images, and they can make a lot of money. As a matter of fact, the demand for desktop images is also met by the current digital photo processing software. For example, when you travel back, you want to use photos as desktop images, you can set the image to a desktop image when processing the image. In this way, you need to use the systemparametersinfo function to complete this task. Of course, this function also has many other functions, such as obtaining the desktop workspace size.

The systemparametersinfo function declaration is as follows:
Winuserapi
Bool
Winapi
Systemparametersinfoa (
_ In uint uiaction,
_ In uint uiparam,
_ Inout_opt pvoid pvparam,
_ In uint fwinini );
Winuserapi
Bool
Winapi
Systemparametersinfow (
_ In uint uiaction,
_ In uint uiparam,
_ Inout_opt pvoid pvparam,
_ In uint fwinini );
# Ifdef Unicode
# Define systemparametersinfo systemparametersinfow
# Else
# Define systemparametersinfo systemparametersinfoa
# Endif //! Unicode

Uiaction is used as different operation parameters.
Uiparam is a set parameter.
Pvparam is a set or returned parameter.
Fwinini is the set parameter.

An example of calling a function is as follows:
#001 //
#002 // obtain system configuration information.
#003 // Cai junsheng 2007/11/16 QQ: 9073204 Shenzhen
#004 void getsystemparam (void)
#005 {
#006 // obtain the desktop wallpaper path.
#007 // spi_get1_wallpaper
#008 tchar chpath [max_path];
#009 if (systemparametersinfo (spi_get1_wallpaper, max_path, chpath, 0 ))
#010 {
#011 //
#012 outputdebugstring (chpath );
#013 outputdebugstring (_ T ("/R/N "));
#014}
#015
#016 // obtain the workspace size.
#017 // spi_getworkarea
#018 rect rcworkarea;
#019 if (systemparametersinfo (spi_getworkarea, 0, & rcworkarea, 0 ))
#020 {
#021 //
#022 const int nbufsize = 256;
#023 tchar chbuf [nbufsize];
#024
#025 wsprintf (chbuf, _ T ("% u, % u"), rcworkarea. Left, rcworkarea. Top,
#026 rcworkarea. Right, rcworkarea. Bottom );
#027
#028 outputdebugstring (chbuf );
#029 outputdebugstring (_ T ("/R/N "));
#030}
#031
#032}

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.