C # Set desktop Wallpaper

Source: Internet
Author: User

It is actually calling the system API. The prototype is:

Bool winapi systemparametersinfo (
_ In uint uiaction,
_ In uint uiparam,
_ In_out pvoid pvparam,
_ In uint fwinini
);

 

1 Using System. runtime. interopservices;
//// Declare
2 [Dllimport ( " User32.dll " , Entrypoint =   " Systemparametersinfoa " )]
3 Static   Extern Int32 systemparametersinfo (int32 uaction, int32 uparam, String Lpvparam int32, fuwinini); ///// set lpvparam to string
4 Private   Const   Int Spi_setdeskwallpaper =   20 ;
5
6 Systemparametersinfo (spi_setdeskwallpaper, 0 , Filename, 1 ); // Call. filename is the image address. If the last parameter needs to be set to, it will be changed back to the original one after restart.

At least Vista is successful.

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.