Jump to content

Background


Recommended Posts

Here is a UDF that change to bmp wallpaper

; Courtesy of ezzetabi.
; The BMP Wallpaperchanger Function.

; Example usage.
_ChangeWallpaper('C:\picture.bmp', 1)


Func _ChangeWallpaper($sFile, $iType)
   ; $iType: 1 = Tiled, 2 = Normal size, 3 = Stretched.
    If Not FileExists($sFile) Then Return 0
    If StringTrimLeft($sFile, StringInStr($sFile, '.', 0, -1)) <> 'bmp' Then Return 0
    Select
        Case $iType = 1
            RegWrite('HKCU\Control Panel\Desktop', 'TileWallpaper', 'reg_sz', '1')
            RegWrite('HKCU\Control Panel\Desktop', 'WallpaperStyle', 'reg_sz', '0')
        Case $iType = 2
            RegWrite('HKCU\Control Panel\Desktop', 'TileWallpaper', 'reg_sz', '0')
            RegWrite('HKCU\Control Panel\Desktop', 'WallpaperStyle', 'reg_sz', '0')
        Case $iType = 3
            RegWrite('HKCU\Control Panel\Desktop', 'TileWallpaper', 'reg_sz', '0')
            RegWrite('HKCU\Control Panel\Desktop', 'WallpaperStyle', 'reg_sz', '2')
    EndSelect
    RegWrite('HKCU\Control Panel\Desktop', 'Wallpaper', 'reg_sz', $sFile)
    DllCall("user32", "int", "SystemParametersInfo", "int", 20, "int", 0, "str", $sFile, "int", 0)
    Return 1
EndFunc
Link to comment
Share on other sites

from wOuter

Func _SetWallpaper($s_BitmapImage, $l_params = 0)
    $ai_Ret = DllCall('user32.dll', 'long', 'SystemParametersInfoA', 'long', 20, 'long', 0, 'str', $s_BitmapImage, 'long', $l_params)
    Return $ai_Ret[0]
EndFunc

http://www.autoitscript.com/forum/index.ph...op++background#

8)

hmm were it says $s_BitmapImage thats were I type my pic name right like this? $s_untitled lol Im not sure
Thanks in advance
Link to comment
Share on other sites

and with yours it didn't work :)

; Courtesy of ezzetabi.
; The BMP Wallpaperchanger Function.

; Example usage.
_ChangeWallpaper("C:\Documents and Settings\Dietmar franken\My Documents\My Pictures\untitled", 1)


Func _ChangeWallpaper($sFile, $iType)
  ; $iType: 1 = Tiled, 2 = Normal size, 3 = Stretched.
    If Not FileExists($sFile) Then Return 0
    If StringTrimLeft($sFile, StringInStr($sFile, '.', 0, -1)) <> 'bmp' Then Return 0
    Select
        Case $iType = 1
            RegWrite('HKCU\Control Panel\Desktop', 'untitled', 'reg_sz', '1')
            RegWrite('HKCU\Control Panel\Desktop', 'Center', 'reg_sz', '0')
        Case $iType = 2
            RegWrite('HKCU\Control Panel\Desktop', 'TileWallpaper', 'reg_sz', '0')
            RegWrite('HKCU\Control Panel\Desktop', 'WallpaperStyle', 'reg_sz', '0')
        Case $iType = 3
            RegWrite('HKCU\Control Panel\Desktop', 'TileWallpaper', 'reg_sz', '0')
            RegWrite('HKCU\Control Panel\Desktop', 'WallpaperStyle', 'reg_sz', '2')
    EndSelect
    RegWrite('HKCU\Control Panel\Desktop', 'untitled', 'reg_sz', $sFile)
    DllCall("user32", "int", "SystemParametersInfo", "int", 20, "int", 0, "str", $sFile, "int", 0)
    Return 1
EndFunc
Thanks in advance
Link to comment
Share on other sites

  • Moderators

hmm were it says $s_BitmapImage thats were I type my pic name right like this? $s_untitled lol Im not sure

More like this:
_SetWallpaper(@MyDocumentsDir & '\MyPictures\MyBitmap.bmp')

Func _SetWallpaper($s_BitmapImage, $l_params = 0)
    $ai_Ret = DllCall('user32.dll', 'long', 'SystemParametersInfoA', 'long', 20, 'long', 0, 'str', $s_BitmapImage, 'long', $l_params)
    Return $ai_Ret[0]
EndFunc

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

and with yours it didn't work :)

; Example usage.
_ChangeWallpaper("C:\Documents and Settings\Dietmar franken\My Documents\My Pictures\untitled", 1)
Where in the path given to the function call is the bmp file tp make it work ? Edited by MHz
Link to comment
Share on other sites

wow either I am a :) or it didn't like my picture

_SetWallpaper(@MyDocumentsDir & '\MyPictures\untitled.bmp')

Func _SetWallpaper($s_untitled, $l_params = 0)
    $ai_Ret = DllCall('user32.dll', 'long', 'SystemParametersInfoA', 'long', 20, 'long', 0, 'str', $s_untitled, 'long', $l_params)
    Return $ai_Ret[0]
EndFunc

I might just make a regwrite that might do it

Edited by Evil_Has_Survived
Thanks in advance
Link to comment
Share on other sites

  • Moderators

wow either I am a :) or it didn't like my picture

Not going there :mellow:

The path is wrong, I was giving an example of how to do it.. it's not MyPictures it's My Pictures

_SetWallpaper(@MyDocumentsDir & '\My Pictures\untitled.bmp')

Func _SetWallpaper($s_untitled, $l_params = 0)
    $ai_Ret = DllCall('user32.dll', 'long', 'SystemParametersInfoA', 'long', 20, 'long', 0, 'str', $s_untitled, 'long', $l_params)
    Return $ai_Ret[0]
EndFunc

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Not going there :mellow:

The path is wrong, I was giving an example of how to do it.. it's not MyPictures it's My Pictures

_SetWallpaper(@MyDocumentsDir & '\My Pictures\untitled.bmp')

Func _SetWallpaper($s_untitled, $l_params = 0)
    $ai_Ret = DllCall('user32.dll', 'long', 'SystemParametersInfoA', 'long', 20, 'long', 0, 'str', $s_untitled, 'long', $l_params)
    Return $ai_Ret[0]
EndFunc
rofl ill try it

Not going there :)

:)
Thanks in advance
Link to comment
Share on other sites

Not going there :>

The path is wrong, I was giving an example of how to do it.. it's not MyPictures it's My Pictures

_SetWallpaper(@MyDocumentsDir & '\My Pictures\untitled.bmp')

Func _SetWallpaper($s_untitled, $l_params = 0)
    $ai_Ret = DllCall('user32.dll', 'long', 'SystemParametersInfoA', 'long', 20, 'long', 0, 'str', $s_untitled, 'long', $l_params)
    Return $ai_Ret[0]
EndFunc
hmm i kept trying it but no use

_SetWallpaper(@MyDocumentsDir & '\My Pictures\untitled.bmp')

Func _SetWallpaper($s_untitled, $l_params = 0)
    $ai_Ret = DllCall('user32.dll', 'long', 'SystemParametersInfoA', 'long', 20, 'long', 0, 'str', $s_untitled, 'long', $l_params)
    Return $ai_Ret[0]
EndFunc

so untitled is my picture name and it should set it but it doesn't (windows XP)

(Bill Gates :):):o:mellow:)

Thanks in advance
Link to comment
Share on other sites

  • Moderators

hmm i kept trying it but no use

_SetWallpaper(@MyDocumentsDir & '\My Pictures\untitled.bmp')

Func _SetWallpaper($s_untitled, $l_params = 0)
    $ai_Ret = DllCall('user32.dll', 'long', 'SystemParametersInfoA', 'long', 20, 'long', 0, 'str', $s_untitled, 'long', $l_params)
    Return $ai_Ret[0]
EndFunc

so untitled is my picture name and it should set it but it doesn't (windows XP)

(Bill Gates :):):o:mellow:)

Is your pictue a .bmp extension? And if it is, was it made that way, or did you just rename it .bmp from a .jpg or .gif or something?

Edit:

MHz's example works well also....

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

I renamed it to .bmp it was a jpg

:)

Wouldn't it stand to reason that.. that wouldn't work?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

well when I went to the properties of it, it now says a a .bmp lol

Yeah, and If I take the Yugo symbol off my car and put a Mercedes one there... does that make it a Mercedes?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...