#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.6.1
Author: 黃岩博創電腦 - Autt
Script Function:
隨機換壁紙
Date :
2011-09-11
Description:
壁紙目錄在C:/windows/wallpaper
只支持將jpg格式的轉換成bmp格式.
Ver : 0.1.0
#ce ----------------------------------------------------------------------------
#AutoIt3Wrapper_Res_Comment=系統 V0.2
#AutoIt3Wrapper_Res_Description=系統 V0.2
#AutoIt3Wrapper_Res_LegalCopyright= 黃岩博創電腦
#AutoIt3Wrapper_Res_Field=產品版本|V0.1.2
#AutoIt3Wrapper_Res_Field=產品名稱|桌面隨心換 V0.1.2
#AutoIt3Wrapper_Res_Field=源文件名|converter.ExE
#AutoIt3Wrapper_Res_Field=內部名稱|點我.exe
#AutoIt3Wrapper_Res_Field=程序作者|JOHn
#AutoIt3Wrapper_Res_Field=日期 | 2011-09-09
#include <GDIPlus.au3>
#include <Array.au3>
Local $arry[1]
Local $count=0
Local $dest="C:\WINDOWS\WallPaper\"
;Global Const $SPI_SETDESKWALLPAPER = 0x0014
;Global Const $SPIF_UPDATEINIFILE = 0x01
;Global Const $SPIF_SENDCHANGE = 0x01
$search=FileFindFirstFile("C:\WINDOWS\WallPaper\"&"*.*")
while 1
$file=FileFindNextFile($search)
if @error then ExitLoop
_ArrayAdd($arry,$file)
$count=$count+1
WEnd ;循環目錄中的所有文件
$rnd=Random(1,$count,1) ; 產生隨機數
$wpaper=$arry[$rnd] ;隨機圖片
_GDIPlus_Startup ()
;初始化gdi
$hImage = _GDIPlus_ImageLoadFromFile ($dest&$wpaper)
;選擇文件,保存句柄到$hImage
$sCLSID = _GDIPlus_EncodersGetCLSID ("BMP")
;理解成要保存的格式??
$tData = DllStructCreate("int Data")
;創建一個類似C++的數據結構
DllStructSetData($tData, "Data", $GDIP_EVTTRANSFORMROTATE90)
$tParams = _GDIPlus_ParamInit (1)
_GDIPlus_ParamAdd ($tParams, $GDIP_EPGTRANSFORMATION, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "Data"))
_GDIPlus_ImageSaveToFileEx ($hImage, "Wallpaper1.bmp", $sCLSID, DllStructGetPtr($tParams))
;保存文件,並命名為wallpaper1.bmp
_GDIPlus_ShutDown ()
;FileCopy("D:\Program Files\AutoIt3\work\Wallpaper1.bmp","C:\Documents and Settings\JOHn\Local Settings\Application Data\Microsoft\Wallpaper1.bmp",1)
dllcall("user32","int","SystemParametersInfo","int",20,"int",1,"str","Wallpaper1.bmp","int",1)
;dllcall("user32","int","SystemParametersInfo","int",$SPI_SETDESKWALLPAPER,"int",1,"str","Wallpaper1.bmp","int",BitOR($SPIF_UPDATEINIFILE,$SPIF_SENDCHANGE))
你用的是註解quote /quote,可以用au3 /au3夾起來 |