January 16, 2021, 10:10:52 PM

Author Topic: windows wallpaper questions  (Read 712 times)

Offline Ashmoor

  • Jr. Member
  • **
  • Posts: 85
windows wallpaper questions
« on: April 02, 2020, 01:47:25 AM »

I am learning how to set a windows desktop wallpaper using my own image.

I found this topic:
https://www.syntaxbomb.com/index.php/topic,2281.msg3270.html#msg3270

For some reason SystemParametersInfoA only changes the wallpaper if the source file path is somewhere in my AppData/Roaming folder.

Why does this happen?
Is there a way to change that?
Where can I find info to learn about this issue in particular and windows specific functions in general?

I've checked this link but I does not help: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-systemparametersinfoa




Offline _PJ_

  • Jr. Member
  • **
  • Posts: 96
Re: windows wallpaper questions
« Reply #1 on: April 02, 2020, 12:20:09 PM »
For some reason SystemParametersInfoA only changes the wallpaper if the source file path is somewhere in my AppData/Roaming folder.

Assignment of desktop wallpaper will copy to a image theme in the requisite location. This needs to be acceisible to roaming profile to ensure that the same wallpaper is correctly assigned across all your sync'd devices
Further, this process protects against instances of source image files being moved/deleted after assigning as Wallpaper.

I am not sure, but I think these should be shared on the current device with %localappdata%\Microsoft\Windows\Themes\RoamedThemeFiles



Offline Henri

  • Sr. Member
  • ****
  • Posts: 288
Re: windows wallpaper questions
« Reply #2 on: April 02, 2020, 02:33:32 PM »
Hi,

this works for me (Win10, file was jpg loaded from the root of C:\ )

Code: BlitzMax
  1. Strict
  2.  
  3. Const SPI_SETDESKWALLPAPER:Int = 20
  4.  
  5. Extern "win32"
  6.         Function SystemParametersInfo:Int(uiAction:Int, uiParam:Int, pvParam:Byte Ptr, fWinIni:Int) = "SystemParametersInfoA@16"
  7. EndExtern
  8.  
  9. Local filter:String="Image Files:png,jpg,bmp"
  10. Local src:String = RequestFile("Give desktop picture..", filter)
  11. If Not src Then
  12.         DebugLog "No file. Ending.."; End
  13. Else
  14.         DebugLog "Processing " + src + ".."
  15. EndIf
  16.  
  17. DebugLog "Calling function -> Return value = " + SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, src.ToCString(), 0)
  18.  

-Henri
- Got 01100011 problems, but the bit ain't 00000001

Offline Ashmoor

  • Jr. Member
  • **
  • Posts: 85
Re: windows wallpaper questions
« Reply #3 on: April 02, 2020, 08:34:55 PM »
@Henri

Thanks. From your example it appears that you cannot pass relative file paths to the system. What I was doing was passing something like "graphics/wallpapers/wallpp.bmp" but for the the "roaming" case I was giving the full path.

@_PJ_
"Assignment of desktop wallpaper will copy to a image theme in the requisite location. This needs to be acceisible to roaming profile to ensure that the same wallpaper is correctly assigned across all your sync'd devices
Further, this process protects against instances of source image files being moved/deleted after assigning as Wallpaper."

Where do you get this kind of information? Is there some windows manual or something?


Offline _PJ_

  • Jr. Member
  • **
  • Posts: 96
Re: windows wallpaper questions
« Reply #4 on: December 27, 2020, 11:51:39 AM »
@_PJ_
"Assignment of desktop wallpaper will copy to a image theme in the requisite location. This needs to be acceisible to roaming profile to ensure that the same wallpaper is correctly assigned across all your sync'd devices
Further, this process protects against instances of source image files being moved/deleted after assigning as Wallpaper."

Where do you get this kind of information? Is there some windows manual or something?
It's just "general knowledge"/common sense of how Windows operates using Roaming Profiles synchronised across multiple AD or devices.

If you set your account's desktop wallpaper in one environment, obviously it will need to be reproduced on other locations you log onto. The original image itself may be in an inaccessible location or access could represent a security or data integrity risk - therefore, it is copied to the roaming directory. Similar practive ahs been in place with Themes and UAP/UAI since earlier iterations of NT


 

SimplePortal 2.3.6 © 2008-2014, SimplePortal