It is currently March 28th, 2024, 6:20 pm

Set your Windows Wallpaper from a skin

Share and get help with Plugins and Addons
Post Reply
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Set your Windows Wallpaper from a skin

Post by jsmorley »

If you want a little image viewer that can set the current image as your desktop background:

Put this in C:\Program Files\Rainmeter\Addons\SetWallpaper\
SetWallpaper.zip
(338.44 KiB) Downloaded 2141 times
AutoIt source code included

Here is a sample skin showing how it works:

[Rainmeter]
Update=1000

[MeasureQuote]
Measure=Plugin
Plugin=Plugins\QuotePlugin.dll
PathName=C:\Users\Jeffrey Morley\Wallpaper
Subfolders=1
FileFilter=*.jpg;*.gif;*.png;*.bmp
UpdateDivider=30

[MeterImage]
Meter=Image
ImageName=[MeasureQuote]
W=200
PreserveAspectRatio=1
DynamicVariables=1
LeftMouseUpAction=!Execute [explorer.exe "[MeasureQuote]"]
RightMouseUpAction=!Execute [!RainmeterRefresh]
MiddleMouseUpAction= !Execute ["#ADDONSPATH#SetWallpaper\SetWallpaper.exe" "[MeasureQuote]"]

AutoIt Source:

Code: Select all

#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <File.au3>

If $CmdLine[0] = 0 Then Exit

$dll = DllOpen("user32.dll")

$ImageToSet = $CmdLine[1]

_setWallPaper($CmdLine[1])

DllClose($dll)

Exit

Func _setWallPaper($ImageToSet)

	If Not FileExists($ImageToSet) Then Return -1
	Dim $szDrive, $szDir, $szFName, $szExt
	$WallPath = _PathSplit($ImageToSet, $szDrive, $szDir, $szFName, $szExt)
	$FullWallpaper = _PathFull($WallPath[2] & "\" & $WallPath[3] & $WallPath[4])
	Local $SPI_SETDESKWALLPAPER = 20
	Local $SPIF_UPDATEINIFILE = 1
	Local $SPIF_SENDCHANGE = 2
	Local $REG_DESKTOP = "HKEY_CURRENT_USERControl PanelDesktop"
	RegWrite($REG_DESKTOP, "TileWallPaper", "REG_SZ", 0)
	RegWrite($REG_DESKTOP, "WallpaperStyle", "REG_SZ", 10)

	DllCall("user32.dll", "int", "SystemParametersInfo", _
			"int", $SPI_SETDESKWALLPAPER, _
			"int", 0, _
			"str", $FullWallpaper, _
			"int", BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDCHANGE))
	Return 0

EndFunc   ;==>_setWallPaper
Post Reply