程序在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下一直返回零,麻烦各位大神支个招