A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Set as Wallpaper

  1. #1
    Does anyone know of a way that I could bypass the whole opening a jpg in a browser window and asking my users to right-click then click 'Set as Wallpaper'?

    There is probably a JScript command that I could access using a .bat file or something?

    Thanks

  2. #2
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766

    I build a FREE tool you can use to do this. Check out http://www.northcode.com/misc/wallpapr.zip (there's are instructions in a PDF file in the ZIP file).


  3. #3
    Thank you

    Can you show me the source code to the application. I would like to understand how the procedure works.


  4. #4
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766

    The application is trivial. You have to update two values in the registry that define how the wallpaper will appear and then call SystemParametersInfo to tell Windows what image to use to refresh the display.

    1. open HKEY_CURRENT_USER\Control Panel\Desktop
    2. set TileWallpaper to 0 (center) or 1 (tile)
    3. set WallPaperStyle to 0 (nornal) or 2 (stretch)
    4. close HKEY_CURRENT_USER\Control Panel\Desktop
    5. use SPI_SETDESKWALLPAPER (SystemParametersInfo) to set the wallpaper image (be sure to use the SPIF_UPDATEINIFILE and SPIF_SENDWININICHANGE flags)

    Most of the code I wrote was to convert the human readable command line arguments to the values that TileWallpaper and WallPaperStyle accept (0,1,2) and that's about as hard as it gets.


  5. #5
    Thanks again,

    I have built something similar but I run into problems when I remove the image from it's current location.

    e.g. if I use the application on an image that is stored on a CD and then I remove the CD the wallpaper disappears. Is the only solution to store the image to a permanent location on my hard-drive or is there a command that I could use to permanently store this as wallpaper

  6. #6
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766

    The path you pass to SystemParametersInfo is the path that windows uses to load the wallpaper each time you adjust the display settings or start windows. You'll have to put the image in a "permanent" location (not the CD) if you want it to stick around.


  7. #7
    Thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center