ytftdkjxkj 2016-04-21 12:02 采纳率: 50%
浏览 2008

vs2012 c# SystemParametersInfo 在win7下无法设置桌面背景

程序在win10下可用.在win7下一直返回值:0
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

    private void Form1_Load(object sender, EventArgs e)
    {
        int temp = SystemParametersInfo(20,0,"C:\\Windows\\Web\\Wallpaper\\img0.bmp",0);
        Console.WriteLine(temp);
    }


    [DllImport("user32.dll", EntryPoint = "SystemParametersInfo")]
    public static extern int SystemParametersInfo(
     int uAction,
     int uParam,
     string lpvParam,
     int fuWinIni
     );


}

}

在win10下正常.在WIN7下一直返回零,麻烦各位大神支个招

  • 写回答

4条回答 默认 最新

  • ytftdkjxkj 2016-04-21 14:00
    关注

    修改注册也只在WIN10有用.WIN7无用.真是奇了怪了

    评论

报告相同问题?