Is there a way to change the lock screen image like the wall paper in c# using pinvoke.
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern Int32 SystemParametersInfo(UInt32 action,
UInt32 uParam, string vParam, UInt32 winIni);
private static readonly UInt32 SPI_SETDESKWALLPAPER = 20;
private static UInt32 SPIF_UPDATEINIFILE = 0x1;
private static uint MAX_PATH = 260;
// then I call
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, file, SPIF_UPDATEINIFILE);
I'd like to do the same for the lockscreen (like the Bing Desktop app is doing)
Given your Windows 8-tag, yes you can:
LockScreen.SetImageFileAsync()
, as demonstrated on Lock screen personalization sample in C# (error handling code omitted, check the sample):
StorageFile imageFile = await imagePicker.PickSingleFileAsync();
// Application now has access to the picked file, setting image to lockscreen.
// This will fail if the file is an invalid format.
await LockScreen.SetImageFileAsync(imageFile);