新手请教,请帮忙看看我写的代码,一点击按钮就显示缺少对象
<input type="button" runat="server" id="btn" onclick="clickk()" value="将此图片设为背景" />
这里出了问题
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Runtime.InteropServices;
public partial class wallpaper : System.Web.UI.Page
{
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni);
protected void Page_Load(object sender, EventArgs e)
{
}
public void clickk()
{
//string filepath = Path.GetFileName(MapPath("Images/豌豆背景.bmp"));
int nResult;
nResult = SystemParametersInfo(20, 1, @"~/Images/豌豆背景.bmp", 0x1 | 0x2);
if (nResult == 0)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('没有更新成功!';)</script>");
}
else
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('更新成功!';)</script>");
}
}
}