-1

Here is my code:

Uri u = new Uri(@"C:\roomieUser\w3.tif");
Windows.System.UserProfile.LockScreen.RequestSetImageFeedAsync(u);

I am trying to change the lock screen in a Windows forms application. I have managed to use WinRT libraries in Windows forms application and there are two methods to change picture one is written above and other is as below

LockScreen.SetImageFileAsync(); //But it requires IStorageFile passed in method

I have pictures stored in "resources" folder, is there any method to convert/use these pictures as IStorageFile?

File path is correct but when I tries to run it shows an error message that

Element not found. (Exception from HRESULT: 0x80070490)

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Asim Mehmood
  • 29
  • 1
  • 4

1 Answers1

0

LockScreen.RequestSetImageFeedAsync is supposed to be called with a Uri pointing to an RSS feed, not an image. This method is deprecated in Windows 10.

You can use StorageFile.GetFileFromApplicationUriAsync to get files from the application's resources folder.

0xcaff
  • 13,085
  • 5
  • 47
  • 55