Hallo,
wie kann ich jpg Bilddateien als Hintergrundbild (Desktop) setzen?
Hallo,
wie kann ich jpg Bilddateien als Hintergrundbild (Desktop) setzen?
Hi,
habe ich heute morgen für Atax schon gemacht. Im Beispiel sind Bild - und GUIgröße nur noch nicht abgestimmt. ![]()
[ gelöst ] GUISETCREATEPIC problem
ZitatDesktop Hintergrundbild setzen (Jpg, nicht bmp)
Ich meinte als Desktop Hintergrundbild. Nicht für GUIs ![]()
Hier hatten wir doch damals ein Thread wo das lange besprochen haben, weil es um ein Script ging
aber hier. Der ist etwas kompliziert
Global Const $SPIF_UPDATEINIFILE = 0x01
Global Const $SPIF_SENDWININICHANGE = 0x02
Global Const $SPI_SETSCREENSAVEACTIVE = 0x11
Global Const $SPI_SETDESKWALLPAPER = 0x14
Global Const $SPI_GETDESKWALLPAPER = 0x73
Global $Bitmap = @WindowsDir & "\WINNT.bmp"
[/autoit] [autoit][/autoit] [autoit]RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "TileWallpaper", "REG_SZ", "0")
RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "WallpaperStyle", "REG_SZ", "0")
_SetDeskWallpaper($Bitmap)
Func _SetDeskWallpaper($Filename)
DllCall("user32.dll", "long", "SystemParametersInfo" _
, "long", $SPI_SETDESKWALLPAPER _
, "long", 0 _
, "str", $Filename _
, "long", BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDWININICHANGE) _
)
EndFunc ;==>_SetDeskWallpaper
Func _GetDeskWallpaper()
Local $Filename = DllStructCreate("char[256]")
DllCall("user32.dll", "long", "SystemParametersInfo" _
, "long", $SPI_GETDESKWALLPAPER _
, "long", 255 _
, "ptr", DllStructGetPtr($Filename) _
, "long", 0 _
)
Return DllStructGetData($Filename, 1)
EndFunc ;==>_GetDeskWallpaper
Standard...
Meine Version:
#include <Misc.au3>
#include <GUIConstants.au3>
#include <File.au3>
#include <array.au3>
#include <GDIPlus.au3>
Opt("GUIOnEventMode", 1)
$start = GUICreate("Wallpaperchanger", 222, 208, 193, 125)
$Labe2 = GUICtrlCreateLabel("Jede 10 Sek wird Hintergrund verändert." & @CRLF & "Lege einen Ordner ''picme'' an und kopiere"& @CRLF &"oder verschiebe deine Wunschbilder dort hinein.", 10, 10, 220, 500)
GUISetOnEvent($GUI_EVENT_MINIMIZE, "CheckDialog")
GUISetState(@SW_Show)
HotKeySet("{f1}", "Exitnow") ;close programm
$dll = DllOpen("user32.dll")
;--------------------------------------------------------;
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]Global Const $SPIF_UPDATEINIFILE = 0x01
Global Const $SPIF_SENDWININICHANGE = 0x02
Global Const $SPI_SETSCREENSAVEACTIVE = 0x11
Global Const $SPI_SETDESKWALLPAPER = 0x14
Global Const $SPI_GETDESKWALLPAPER = 0x73
while 1
$ppic = _FileListToArray(@MyDocumentsDir & "\picme\", "*.jpg")
$result = _ArrayMax($ppic)
$rpic = $ppic[random(0, $result ,0)]
Global $Bitmap = @MyDocumentsDir & "\picme\"& $rpic
RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "TileWallpaper", "REG_SZ", "0")
RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "WallpaperStyle", "REG_SZ", "2")
$ext = StringTrimLeft($Bitmap, StringInStr($Bitmap, ".", -1))
If not ($ext = "bmp") then
_GDIPlus_Startup()
$Bild = _GDIPlus_ImageLoadFromFile($Bitmap)
_GDIPlus_ImageSaveToFile($Bild, @MyDocumentsDir & "\picme\picme.bmp")
_GDIPlus_ImageDispose($Bild)
_GDIPlus_Shutdown()
endif
_SetDeskWallpaper(@MyDocumentsDir & "\picme\picme.bmp")
sleep(10000)
WEnd
;--------------------------------------------------------;
[/autoit] [autoit][/autoit] [autoit];Funktionen - Anfang;
Func _SetDeskWallpaper($Filename)
DllCall("user32.dll", "long", "SystemParametersInfo" _
, "long", $SPI_SETDESKWALLPAPER _
, "long", 0 _
, "str", $Filename _
, "long", BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDWININICHANGE) _
)
EndFunc ;==>_SetDeskWallpaper
Func _GetDeskWallpaper()
Local $Filename = DllStructCreate("char[256]")
DllCall("user32.dll", "long", "SystemParametersInfo" _
, "long", $SPI_GETDESKWALLPAPER _
, "long", 255 _
, "ptr", DllStructGetPtr($Filename) _
, "long", 0 _
)
Return DllStructGetData($Filename, 1)
EndFunc ;==>_GetDeskWallpaper
Func Exitnow()
Exit
EndFunc
Func CheckDialog()
Select
Case @GUI_CTRLID = $GUI_EVENT_MINIMIZE
GUISetState(@SW_HIDE)
EndSelect
EndFunc
;Funktionen - Ende;
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend
Meiner ändert nach ne Zeit Desktopbild. Bilder in Eigene Datein\picme\* Verzeichnis