C#修改电脑桌面图

win32helper

public class Win32Helper
{
    [DllImport("user32.dll", EntryPoint = "SystemParametersInfoA")]
    internal static extern Int32 SystemParametersInfo(Int32 uAction, Int32 uParam, string lpvparam, Int32 fuwinIni);
}

调用(win10背景图:C:\Windows\Web\Wallpaper)

void SetWallpaper(string imgPath)
{
    int nResult;
    nResult = Win32Helper.SystemParametersInfo(20, 1, imgPath, 0x1 | 0x2);
}

 http://winapi.freetechsecrets.com/win32/WIN32SystemParametersInfo.htm

posted @ 2019-07-26 14:42  xiao贝  阅读(644)  评论(0编辑  收藏  举报