3

I've searched a lot about this topic and couldn't find a good solution, so:

Is there a way to change the desktop wallpaper from within a windows8.1 app using c#/xaml? eg. by simply providing an image?

malte
  • 1,171
  • 1
  • 15
  • 28

2 Answers2

5

As far as i know Win 8 Apps are Sandboxed

You have to Subscribe to everything not included in that Sandbox like using Audio output, the Webcam etc. so the Windows Appstore can show a user what your App wants to Access.

If Windows 8 doesn't provide "Desktop Control" as Subscribable Interface you cannot do this in an App

(I have no Win 8+VisualStudio here so i can't test it right now)

Michael S. Scherotter
  • 10,715
  • 3
  • 34
  • 57
BigM
  • 678
  • 1
  • 17
  • 28
2

You should look into creating a Theme Pack in Windows 8

http://msdn.microsoft.com/en-us/library/windows/desktop/bb773190(v=vs.85).aspx

It looks like LaunchFileAsync() blocks certain file types and .theme and .deskthemepack are blocked. You will need have the user download the file to their desktop and then double-click on the file.

There is currently no way to set the desktop background - but you can set the lock screen background in a Windows Store app.

Michael S. Scherotter
  • 10,715
  • 3
  • 34
  • 57
  • Wow, nice idea! But it does not work via LaunchFileAsync. I have no idea why, but nothing happens!? - The .theme file I created works if I execute it from the desktop, and the file is found. If I try launching a *.png it works with the same code. Do you have any ideas about this, or is *.theme simply not supported? – malte Nov 05 '13 at 08:53
  • what is the result of the async operation? Where is the storage file located? did you copy it to the temp directory first? – Michael S. Scherotter Nov 06 '13 at 04:40
  • For testing purposes I located both files (*.theme and *.png) in my Assets folder. `var success = await Windows.System.Launcher.LaunchFileAsync(file);` "success" is true for the *.png (and the *png is launched) and false for the *.theme. Both files are in the same directory and I double checked spelling and also made sure that file != null. (It is not even for the *.theme) – malte Nov 06 '13 at 07:17
  • I just did some deeper debugging with ProcMon and I think I found the error. It tells me that file access was successful, but **QueryRemoteProtocolInformation** results in _INVALID PARAMETER_. What does that mean? Do I have to change the generating of the theme file, or is it just not recognized? – malte Nov 06 '13 at 07:35