Det her virker for mig:
[DllImport("user32.dll", CharSet = CharSet.Auto)]
static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni);
public MyForm(){
// Eventhandler btn1_Clicked
}
public void btn1_Clicked(object sender, EventArgs e){
SystemParametersInfo(20, 0, "Placering af billede\\billede.jpg", 0x01 | 0x02);
RegistryKey rkWallPaper = Registry.CurrentUser.OpenSubKey("Control Panel\\\\Desktop", true);
rkWallPaper.SetValue("WallpaperStyle", 2);
rkWallPaper.SetValue("TileWallpaper", 0);
rkWallPaper.Close();
}
Indlæg senest redigeret d. 10.01.2008 14:13 af Bruger #13071