The following forum(s) are migrating to a new home on Microsoft Q&A (Preview): Developing Universal Windows apps!

Ask new questions on Microsoft Q&A (Preview).
Interact with existing posts until December 13, 2019, after which content will be closed to all new and existing posts.

Learn More

 none
[UWP][C++/CX] How to use TrySetWallpaperImageAsync? RRS feed

  • Question

  • How to use TrySetWallpaperImageAsync? Always return false.

    //_File is a StorageFile^
    create_task(UserProfilePersonalizationSettings::Current->TrySetWallpaperImageAsync(_File)).then([](task<bool> _t)
    {
        try
        {
            //_Txt is a TextBlock
            _Txt->Text = _t.get().ToString();
        }
        catch (...) {}
    }, task_continuation_context::use_current());

    Friday, October 9, 2015 4:16 PM

All replies

  • Hello,

    I guess this could be related with the device beucase according to your code, I made two tests with a virtual machine and a physical machine, the result is:

    When testing on a virtual machine, the method TrySetWallpaperImageAsync always return false.

    When test on a physical machine, it could work as expected. So if you are using a virtual machine to make the test, I suggest you could also try to test this method on a physical one since it works on my side.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, October 12, 2015 3:39 AM
  • Please beware that feature could be disabled by Group policy on your machine.

    Check that stuff before smashing your head on your code!


    Matteo Marcianò - founder of ByteStorms

    Monday, October 12, 2015 6:47 AM
  • Thank you Fred and Matteo. I don't use virtual machine, I debug in desktop Windows10 Pro, no virtual machine. I try every way, but still return false. And Windows10 Photos App can set, so I think there is no Group policy.
    Monday, October 12, 2015 8:05 AM
  • Hello,

    Could you please share the project with us? I would help test it on my side to check if I could reproduce your described scenario.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, October 14, 2015 10:22 AM
  • I found a c# sample (http://files.cnblogs.com/files/tcjiaan/CustomWallpage.zip), this sample also always return false. I create a new blank app, and just use TrySetWallpaperImageAsync, still return false. But Windows Photos App is OK. I don't why?
    Wednesday, October 14, 2015 2:42 PM
  • The sample could work on my virtual machine…

    Here is a screenshot:

    You see the wallpaper Image is changed...So I guess this may be related with account setting as Matteo mentioned.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, October 16, 2015 10:07 AM
  • Thanks Fred. On my computer it doesn't work, but Windows App Photos can work, so I'm confused. And there is no details (https://msdn.microsoft.com/en-us/library/windows/apps/windows.system.userprofile.userprofilepersonalizationsettings.trysetwallpaperimageasync.aspx?cs-save-lang=1&cs-lang=cpp#code-snippet-1). The return value is only a boolean, no error message. On this situation, how to solve this problem?

    Friday, October 16, 2015 11:18 AM
  • I currently have no idea why it does not work on your side, I am trying to invoke someone experienced to help check it and it may take some time and as soon as we get any result, we will post an update to here.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, October 19, 2015 10:16 AM
  • I'm having the same problem, always returns false???
    Monday, October 26, 2015 4:19 AM