找回密码
 加入
搜索
查看: 2015|回复: 6

[AU3基础] [已解决]如何让AutoIt更换壁纸时有淡出淡入效果?

  [复制链接]
发表于 2012-3-20 23:14:40 | 显示全部楼层 |阅读模式
本帖最后由 wl00560 于 2012-3-22 18:53 编辑

下了个代码:
$s_BitmapImage="c:\2002-10-29-10_jp.jpg"
_SetWallpaper($s_BitmapImage, 0)
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
可以更换,但没有淡出淡入效果了,请问如何才能有淡出淡入效果?

评分

参与人数 1金钱 +15 收起 理由
afan + 15 感谢主动将修改帖子分类为[已解决],请继续 ...

查看全部评分

 楼主| 发表于 2012-3-21 13:38:14 | 显示全部楼层
对了,我的系统就是Windows 7……
因为Windows 7自带的只能用一个目录的图片,所以想用别的软件来更换壁纸……
可是没有淡出淡入效果,AutoIt应该能做到这点吧……
发表于 2012-3-21 21:45:55 | 显示全部楼层
Return $ai_Ret[0]     系统的问题吧?
发表于 2012-3-22 00:24:21 | 显示全部楼层
本帖最后由 lixiaolong 于 2012-3-22 01:00 编辑


$s_BitmapImage="c:\2002-10-29-10_jp.jpg"
_SetWallpaper($s_BitmapImage, 0)

Func _SetWallpaper($s_BitmapImage, $l_params = 0, $s_Sleep = 10)
        SplashImageOn("Splash", $s_BitmapImage, @DesktopWidth + 2, @DesktopHeight + 2, -2, -2, 1)
        WinSetTrans('Splash', "", 0)

        For $trans = 0 To 255
                If $trans = 255 Then _
                                $ai_Ret = DllCall('user32.dll', 'long', 'SystemParametersInfoA', 'long', 0x14, 'long', 0, 'str', $s_BitmapImage, 'long', $l_params)
                WinSetTrans("Splash", "", $trans)
                Sleep($s_Sleep)
        Next
        SplashOff()

        Return $ai_Ret[0]
EndFunc   ;==>_SetWallpaper
 楼主| 发表于 2012-3-22 13:07:53 | 显示全部楼层
谢谢,可惜换的时候会短暂的消失窗口,有点晃眼……
能不能在后台换,不影响当前的窗口?
发表于 2012-3-22 18:20:21 | 显示全部楼层
本帖最后由 lixiaolong 于 2012-3-22 18:25 编辑

回复 5# wl00560

看看这个可以不?桌面图标还是消失一下.
#include <WinAPI.au3>
#include <Constants.au3>

$s_BitmapImage = "Desert.jpg"
_SetWallpaper($s_BitmapImage, 0, 1)

Func _SetWallpaper($s_BitmapImage, $l_params = 0, $s_Sleep = 10)
        Local $trans, $ai_Ret
        
        SplashImageOn("Splash", $s_BitmapImage, @DesktopWidth + 2, @DesktopHeight - 28, -2, -2, 1)
        _WinAPI_SetWindowPos(WinGetHandle("Splash"), $HWND_BOTTOM, -2, -2, @DesktopWidth + 2, @DesktopHeight - 28, $SWP_NOACTIVATE)
        
        WinSetTrans('Splash', "", 0)

        For $trans = 0 To 255
                If $trans = 255 Then _
                                $ai_Ret = DllCall('user32.dll', 'long', 'SystemParametersInfoA', 'long', 0x14, 'long', 0, 'str', $s_BitmapImage, 'long', $l_params)
                WinSetTrans("Splash", "", $trans)
                Sleep($s_Sleep)
        Next
        SplashOff()

        Return $ai_Ret[0]
EndFunc   ;==>_SetWallpaper

评分

参与人数 1金钱 +20 贡献 +1 收起 理由
afan + 20 + 1

查看全部评分

 楼主| 发表于 2012-3-22 18:53:27 | 显示全部楼层
可以了,谢谢你的帮助……
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-21 12:36 , Processed in 0.087247 second(s), 28 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表