【问题标题】:Wallpaper change in windows 10 [duplicate]Windows 10中的壁纸更改[重复]
【发布时间】:2016-07-24 05:51:59
【问题描述】:

此代码在 Windows 7 中有效,但在 Windows 10 中无效。 而不是改变壁纸只是黑屏

[DllImport("User32", CharSet = CharSet.Auto)]
    public static extern int SystemParametersInfo(int uiAction, int uiParam,
        string pvParam, uint fWinIni);
    static void Main(string[] args)
    {
        SystemParametersInfo(0x0014, 0, "Image.jpg", 0x0001);
    }

【问题讨论】:

  • 使用图片的完整路径。这行得通吗?
  • 有帮助,非常感谢
  • 好的,我把它作为答案发布了
  • 你看到答案了吗?如果有效,请接受它作为答案

标签: c# windows-10 wallpaper


【解决方案1】:

不要只传递Image.jpg,而是使用完整路径:

SystemParametersInfo(0x0014, 0, "C:\\Image.jpg", 0x0001);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-10
    • 1970-01-01
    • 1970-01-01
    • 2014-05-28
    • 2019-10-01
    • 2021-02-20
    相关资源
    最近更新 更多