public void SetDesktopBackground(string fileName)
{
try
{
if (GlobalVariables.LoggingEnabled) ExceptionManager.WriteInformation("Preparing to change desktop background");
SystemParametersInfo(SpiSetdeskwallpaper, 0, fileName, SpifUpdateinifile);
if (GlobalVariables.LoggingEnabled) ExceptionManager.WriteInformation("Completed desktop background change");
}
catch (Exception ex)
{
if (GlobalVariables.LoggingEnabled) ExceptionManager.WriteInformation("An error occurred updating the desktop background.");
ExceptionManager.WriteException(ex);
}
}