#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=..\..\ico\34.Ico #AutoIt3Wrapper_Outfile=..\..\EXEC\Windows Theme Changeur.Exe ;~ #AutoIt3Wrapper_AU3Check_Parameters=-w 5 -w 3 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include #include #include #include #include #include #include #include #include #include #include #include #include #include Opt('MustDeclareVars', 1) #Region Variables Global Const $AppTitle = 'Windows Thèmes Changeur' Global Const $DlPath = @MyDocumentsDir & '\' & $AppTitle & '\' Global Const $Path_Ini_Config = @MyDocumentsDir & '\' & $AppTitle & '\Conf.ini' Global Const $Path_Ini_DefaultConfig = @MyDocumentsDir & '\' & $AppTitle & '\Default.ini' Global Const $Path_Ini_DefaultTheme = @MyDocumentsDir & '\' & $AppTitle & '\_mytheme.ini' If Not FileExists($DlPath) Then DirCreate($DlPath) If Not FileExists($Path_Ini_DefaultConfig) Then _InetGet('https://www.dropbox.com/s/lvcgb9nq3kvu09w/_mytheme.ini?dl=1', $Path_Ini_DefaultConfig, True) If Not FileExists($Path_Ini_DefaultTheme) Then _InetGet('https://www.dropbox.com/s/d8lggn6tf0buozz/Default.ini?dl=1', $Path_Ini_DefaultTheme, True) Local $sDate = @YEAR & '/' & @MON & '/' & @MDAY If IniRead($Path_Ini_Config, 'Date', $sDate, '') = '' Then IniWrite($Path_Ini_Config, 'Date', $sDate, 1) _InetGet('https://www.dropbox.com/s/o3juedisko10q53/Themes.dropbox?dl=1', $DlPath & 'Themes.dropbox', True) EndIf If Not FileExists($DlPath & 'Themes.dropbox') Then _InetGet('https://www.dropbox.com/s/o3juedisko10q53/Themes.dropbox?dl=1', $DlPath & 'Themes.dropbox', True) Global $ThemeSearchPath[2] = [@UserProfileDir & '\AppData\Local\Microsoft\Windows\Themes\', @WindowsDir & '\Resources\Themes\'] Global Const $DlItem = 'Telechargments' Global Const $sFilter = '*.bmp;*.jpg;*.jpeg;*.png;*.gif;*.jpeg' Global $CreateTheme = False Global $GalleryCheckCrop, $HwndGalleryLv, $GalleryLvPic, $GalleryLvPicW, $GalleryLvPicH, $GalleryLvPicL, $GalleryLvPicT, $Gallery Global $SelectedWpXo, $SelectedWpYo, $SelectedWpHeight, $SelectedWpWidth, $SelectedWpTop, $SelectedWpLeft Global $ChooseColor Global $ArrFullPath = 0 #EndRegion Variables #Region Gui Local $sWgui = 830 Local $sHgui = 630 Global Const $hGui = GUICreate($AppTitle, $sWgui, $sHgui) Global Const $DummyMenuListView = GUICtrlCreateDummy() Global Const $MenuListView = GUICtrlCreateContextMenu($DummyMenuListView) Global Const $MenuListView_Appliquer = GUICtrlCreateMenuItem("&Appliquer", $MenuListView) Global Const $MenuListView_Supprimer = GUICtrlCreateMenuItem("&Supprimer", $MenuListView) Global Const $MenuListView_Extraire = GUICtrlCreateMenuItem("&Extraire", $MenuListView) Global Const $MenuListView_Ajouter = GUICtrlCreateMenuItem("&Ajouter", $MenuListView) Global Const $MenuListView_Create = GUICtrlCreateMenuItem("&Creer un theme", $MenuListView) Global Const $DummyMenuListView2 = GUICtrlCreateDummy() Global Const $MenuListView2 = GUICtrlCreateContextMenu($DummyMenuListView2) Global Const $MenuListView2_Appliquer = GUICtrlCreateMenuItem("&Appliquer", $MenuListView2) Global Const $MenuListView2_Supprimer = GUICtrlCreateMenuItem("&Supprimer", $MenuListView2) Global Const $MenuListView2_Extraire = GUICtrlCreateMenuItem("&Extraire", $MenuListView2) Global Const $MenuListView2_Ajouter = GUICtrlCreateMenuItem("&Ajouter", $MenuListView2) Global Const $Dummy2MenuListView = GUICtrlCreateDummy() Global Const $Menu2ListView = GUICtrlCreateContextMenu($Dummy2MenuListView) Global Const $Menu2ListView_Create = GUICtrlCreateMenuItem("&Creer un theme", $Menu2ListView) Global Const $Dummy2MenuListView2 = GUICtrlCreateDummy() Global Const $Menu2ListView2 = GUICtrlCreateContextMenu($Dummy2MenuListView2) Global Const $Menu2ListView2_Ajouter = GUICtrlCreateMenuItem("&Ajouter", $Menu2ListView2) Local $sWlv = $sWgui - 32 Local $Left Global Const $ListView1 = GUICtrlCreateListView("", 8, 8, ($sWlv / 2) - 5, ($sHgui / 2) - 13) Global Const $hwndListView1 = GUICtrlGetHandle($ListView1) _GUICtrlListView_InsertColumn($ListView1, 0, "Themes (Double clique pour appliquer)", 1000) _GUICtrlListView_InsertColumn($ListView1, 1, "", 1000) Local $top = 8 $Left = ($sWlv / 2) + 15 GUICtrlCreateLabel("Changer l'image toutes les", $Left, $top, 150) $top += 25 Global Const $CmbInterval = GUICtrlCreateCombo("", $Left, $top, 80) $Left += 85 GUICtrlCreateLabel("Minutes", $Left, $top + 3, 50) Local $data = '' For $i = 1 To 250 $data &= $i & '|' Next GUICtrlSetData($CmbInterval, $data, 10) $Left = ($sWlv / 2) + 15 $top += 35 GUICtrlCreateLabel("Lecture aléatoire", $Left, $top, 150) $top += 20 Global Const $CheckRandom = GUICtrlCreateCheckbox("Activer", $Left, $top, 80) $Left = ($sWlv / 2) + 15 $top += 35 GUICtrlCreateLabel("Choisir un ajustement", $Left, $top, 150) $top += 25 Global Const $CmbAdjust = GUICtrlCreateCombo("", $Left, $top, 150) GUICtrlSetData(-1, 'Remplir|Ajuster|Etirer|Vignette|Centrer|Etendre', 'Remplir') $top += 40 Global Const $ChecDefaultCursorSounds = GUICtrlCreateButton("Curseurs et son par default", $Left, $top, 150, 25) $top = 8 $Left = ($sWlv / 2) + 190 GUICtrlCreateLabel("Choisir automatiquement une couleur d'accentuation a partir de l'arière-plan", $Left, $top, 245, 25) $top += 25 Global Const $CheckAutoColorization = GUICtrlCreateCheckbox("Activer", $Left, $top, 80) $top += 25 GUICtrlCreateLabel("Choisir manuellement une Couleur", $Left, $top, 245) $top += 20 Global Const $LblBkColor = GUICtrlCreateLabel("", $Left, $top, 25, 25) GUICtrlSetCursor(-1, 0) GUICtrlSetBkColor(-1, 0) GUICtrlSetState(-1, 128) $Left += 40 Global $arrLblBkColor[6] Global $countBkColor = 0 Global $arrBkColor[6] = [0X000000, 0X00FF00, 0x0000FF, 0XFF0000, 0x00FFFF, 0xFF9912] For $i = 0 To UBound($arrLblBkColor) - 1 $arrLblBkColor[$i] = GUICtrlCreateLabel("", $Left, $top, 25, 25) GUICtrlSetCursor($arrLblBkColor[$i], 0) GUICtrlSetBkColor($arrLblBkColor[$i], "0x" & Hex($arrBkColor[$i], 6)) GUICtrlSetState($arrLblBkColor[$i], 128) $Left += 30 Next $Left = ($sWlv / 2) + 190 $top += 35 GUICtrlCreateLabel("Effets de transparence", $Left, $top, 150) $top += 20 Global Const $CheckTranasparence = GUICtrlCreateCheckbox("Activer", $Left, $top, 80) $top += 35 GUICtrlCreateLabel("Afficher la couleur d'accentuation sur les srufaces suivantes :", $Left, $top, 245, 25) $top += 25 Global Const $CheckColorPrevalenceMenu = GUICtrlCreateCheckbox("Menu demarer, barre des taches, notification", $Left, $top, 245) $top += 20 Global Const $CheckColorPrevalenceTask = GUICtrlCreateCheckbox("Barres de titre", $Left, $top, 150) $top += 30 Global Const $CheckDarkStyle = GUICtrlCreateCheckbox("Activer le mode sombre", $Left, $top, 150) $top += 45 $Left = ($sWlv / 2) + 10 Global Const $BtnRefresh = GUICtrlCreateButton("Applquer les modifications", $Left, $top, (($sWlv / 2) + 10) / 2, 25) $Left += (($sWlv / 2) + 15) / 2 Global Const $BtnRefreshExplorer = GUICtrlCreateButton("Relancer l'explorer", $Left, $top, (($sWlv / 2) + 10) / 2, 25) Global Const $ListView2 = GUICtrlCreateListView("", 8, ($sHgui / 2) + 5, ($sWlv / 2) - 5, ($sHgui / 2) - 12) Global Const $hwndListView2 = GUICtrlGetHandle($ListView2) _GUICtrlListView_InsertColumn($ListView2, 0, "Fond d'écran (Double clique pour appliquer)", 1000) _GUICtrlListView_InsertColumn($ListView2, 1, "Url", 1000) Global $sWpic = ($sWlv / 2) - 15 Global $sHpic = ($sHgui / 2) - 42 Global $sLpic = ($sWlv / 2) + 10 Global $sTpic = ($sHgui / 2) + 5 Global Const $pic = GUICtrlCreatePic('', $sLpic, $sTpic, $sWpic, $sHpic) GUICtrlSetCursor(-1, 0) Global Const $MenuPic = GUICtrlCreateContextMenu($pic) Global Const $MenuPic_Rotate90Right = GUICtrlCreateMenuItem("Rotation 90° droite", $MenuPic) Global Const $MenuPic_Rotate90Left = GUICtrlCreateMenuItem("Rotation 90° guauche", $MenuPic) Global Const $MenuPic_RotateInvers = GUICtrlCreateMenuItem("Rotation horizontal", $MenuPic) GUICtrlCreateMenuItem("", $MenuPic) Global Const $MenuPic_Set = GUICtrlCreateMenuItem("Appliquer le recadrage", $MenuPic) GUICtrlCreateMenuItem("", $MenuPic) Global Const $MenuPic_SetWPAdjust = GUICtrlCreateMenuItem("Appliquer en tant qu'arriere plan du bureau : Ajuster", $MenuPic) Global Const $MenuPic_SetWpCrop = GUICtrlCreateMenuItem("Appliquer en tant qu'arriere plan du bureau : Recadrer et remplir", $MenuPic) Global Const $PicSliderV = GUICtrlCreateSlider((($sWlv / 2) + 10) + $sWpic + 5, ($sHgui / 2) + 5, 21, $sHpic, $TBS_VERT + $TBS_LEFT + $TBS_NOTICKS + $TBS_FIXEDLENGTH) GUICtrlSetState(-1, 32) GUICtrlSetLimit($PicSliderV, 210, 0) Global Const $PicSliderH = GUICtrlCreateSlider(($sWlv / 2) + 10, (($sHgui / 2) + 5) + $sHpic + 5, $sWpic, 21, $TBS_NOTICKS + $TBS_TOP + $TBS_FIXEDLENGTH) GUICtrlSetState(-1, 32) GUICtrlSetLimit($PicSliderH, 240, 0) Local $sFind = _LvSetCurrentTheme() _GUICtrlSetStateOptions(64) _SetOptions(_GUICtrlListView_GetItemText($ListView1, $sFind, 1)) $countBkColor = 0 $arrBkColor[0] = 0X000000 GUICtrlSetBkColor($arrLblBkColor[0], "0x" & Hex(0X000000, 6)) GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") GUISetState() #EndRegion Gui Func _MainLoop() Local $nMsg, $Path, $cc, $iDiff, $nb While 1 If $CreateTheme Then _CreateCustomizerTheme() $CreateTheme = False EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $MenuPic_SetWpCrop _ChangeWallpaperEx(0) Case $MenuPic_SetWPAdjust _ChangeWallpaperEx(1) Case $MenuPic_RotateInvers _ImageRotateFlip(4) _FileMove() _ActuPreview() Case $MenuPic_Rotate90Left _ImageRotateFlip(3) _FileMove() _ActuPreview() Case $MenuPic_Rotate90Right _ImageRotateFlip(1) _FileMove() _ActuPreview() Case $MenuPic_Set If FileExists($DlPath & 'Theme changeur sCrop.jpg') Then If MsgBox(4, $AppTitle, 'Remplacer : ' & @CRLF & _Lv2SearchFullPathWp(_GUICtrlListView_GetItemText($ListView2, _ListView_GetItemSelected($ListView2), 0)) & @CRLF & 'par limage recadrer ?') = 6 Then _FileMove($DlPath & 'Theme changeur sCrop.jpg') _ActuPreview() EndIf EndIf Case $pic DllCall("user32.dll", "ptr", "SendMessage", "hwnd", $hGui, "int", $WM_CONTEXTMENU, "int", ControlGetHandle($hGui, "", $pic), "int", 0) Case $PicSliderV $iDiff = $SelectedWpYo - $SelectedWpHeight $nb = GUICtrlRead($PicSliderV) $SelectedWpTop = $iDiff * $nb / 210 _UpdatePreview() Case $PicSliderH $iDiff = $SelectedWpXo - $SelectedWpWidth $nb = GUICtrlRead($PicSliderH) $SelectedWpLeft = $iDiff * $nb / 240 _UpdatePreview() Case $BtnRefreshExplorer _RefreshExplorer() Case $BtnRefresh _BtnRefresh() If _CheckIfRefreshExplorer() Then _RefreshExplorer() Case $CmbAdjust $Path = _GetThemeFile() Local $sDefault Switch GUICtrlRead($CmbAdjust) Case 'Etendre' $sDefault = 5 Case 'Ajuster' $sDefault = 3 Case 'Etirer' $sDefault = 2 Case 'Vignette' $sDefault = 1 Case 'Centrer' $sDefault = 0 Case 'Remplir' $sDefault = 4 EndSwitch IniWrite($DlPath & 'temp.ini', 'Control Panel\Desktop', 'PicturePosition', $sDefault) FileCopy($DlPath & 'temp.ini', $Path, 1) Case $ChecDefaultCursorSounds $Path = _GetThemeFile() IniWrite($DlPath & 'temp.ini', 'VisualStyles', 'AutoColorization', 1) IniDelete($DlPath & 'temp.ini', 'Control Panel\Cursors') Local $section = IniReadSection($Path_Ini_DefaultConfig, 'Control Panel\Cursors') For $i = 1 To UBound($section) - 1 IniWrite($DlPath & 'temp.ini', 'Control Panel\Cursors', $section[$i][0], $section[$i][1]) Next IniDelete($DlPath & 'temp.ini', 'Sounds') IniWrite($DlPath & 'temp.ini', 'Sounds', 'SchemeName', '@%SystemRoot%\System32\mmres.dll,-800') FileCopy($DlPath & 'temp.ini', $Path, 1) _BtnRefresh() _RefreshExplorer() Case $CheckAutoColorization $Path = _GetThemeFile() If _IsChecked($CheckAutoColorization) Then GUICtrlSetState($LblBkColor, 128) For $i = 0 To UBound($arrLblBkColor) - 1 GUICtrlSetState($arrLblBkColor[$i], 128) Next IniWrite($DlPath & 'temp.ini', 'VisualStyles', 'AutoColorization', 1) Else GUICtrlSetState($LblBkColor, 64) For $i = 0 To UBound($arrLblBkColor) - 1 GUICtrlSetState($arrLblBkColor[$i], 64) Next IniWrite($DlPath & 'temp.ini', 'VisualStyles', 'AutoColorization', 0) GUICtrlSetBkColor($LblBkColor, "0x" & Hex(IniRead($DlPath & 'temp.ini', 'VisualStyles', 'ColorizationColor', ''), 6)) EndIf FileCopy($DlPath & 'temp.ini', $Path, 1) Case $CheckTranasparence $Path = _GetThemeFile() If _IsChecked($CheckTranasparence) Then RegWrite('HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize', 'EnableTransparency', 'REG_DWORD', 1) IniWrite($DlPath & 'temp.ini', 'VisualStyles', 'Transparency', 1) Else RegWrite('HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize', 'EnableTransparency', 'REG_DWORD', 0) IniWrite($DlPath & 'temp.ini', 'VisualStyles', 'Transparency', 0) EndIf FileCopy($DlPath & 'temp.ini', $Path, 1) Case $CheckColorPrevalenceMenu $Path = _GetThemeFile() If _IsChecked($CheckColorPrevalenceMenu) Then RegWrite('HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize', 'ColorPrevalence', 'REG_DWORD', 1) Else RegWrite('HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize', 'ColorPrevalence', 'REG_DWORD', 0) EndIf FileCopy($DlPath & 'temp.ini', $Path, 1) Case $CheckColorPrevalenceTask $Path = _GetThemeFile() If _IsChecked($CheckColorPrevalenceTask) Then RegWrite('HKCU\SOFTWARE\Microsoft\Windows\DWM', 'ColorPrevalence', 'REG_DWORD', 1) Else RegWrite('HKCU\SOFTWARE\Microsoft\Windows\DWM', 'ColorPrevalence', 'REG_DWORD', 0) EndIf FileCopy($DlPath & 'temp.ini', $Path, 1) Case $CheckDarkStyle $Path = _GetThemeFile() If _IsChecked($CheckDarkStyle) Then RegWrite('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize', 'AppsUseLightTheme', 'REG_DWORD', 0) RegWrite('HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize', 'AppsUseLightTheme', 'REG_DWORD', 0) Else RegDelete('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize', 'AppsUseLightTheme') RegDelete('HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize', 'AppsUseLightTheme') EndIf FileCopy($DlPath & 'temp.ini', $Path, 1) Case $CmbInterval $Path = _GetThemeFile() IniWrite($DlPath & 'temp.ini', 'Slideshow', 'Interval', GUICtrlRead($CmbInterval) * 60000) FileCopy($DlPath & 'temp.ini', $Path, 1) Case $CheckRandom $Path = _GetThemeFile() If _IsChecked($CheckRandom) Then IniWrite($DlPath & 'temp.ini', 'Slideshow', 'Shuffle', 1) Else IniWrite($DlPath & 'temp.ini', 'Slideshow', 'Shuffle', 0) EndIf FileCopy($DlPath & 'temp.ini', $Path, 1) Case $LblBkColor $cc = _ChooseColor(2, IniRead($DlPath & 'temp.ini', 'VisualStyles', 'ColorizationColor', ''), 2, $hGui) If Not @error Then $ChooseColor = "0x" & Hex($cc, 6) $Path = _GetThemeFile() GUICtrlSetBkColor($LblBkColor, $ChooseColor) IniWrite($DlPath & 'temp.ini', 'VisualStyles', 'ColorizationColor', $cc) FileCopy($DlPath & 'temp.ini', $Path, 1) EndIf Case -3 _GDIPlus_Shutdown() FileDelete($DlPath & '*.bmp') FileDelete($DlPath & '*.jpg') If FileExists($DlPath & 'Nouveau dossier') Then DirRemove($DlPath & 'Nouveau dossier', 1) If FileExists($DlPath & 'exif.txt') Then FileDelete($DlPath & 'exif.txt') If FileExists($DlPath & 'TempWPTTheme.ini') Then FileDelete($DlPath & 'TempWPTTheme.ini') If FileExists($DlPath & 'temp.ini') Then FileDelete($DlPath & 'temp.ini') Exit EndSwitch For $i = 0 To UBound($arrLblBkColor) - 1 If $nMsg = $arrLblBkColor[$i] Then $ChooseColor = "0x" & Hex($arrBkColor[$i], 6) $Path = _GetThemeFile() GUICtrlSetBkColor($LblBkColor, $ChooseColor) IniWrite($DlPath & 'temp.ini', 'VisualStyles', 'ColorizationColor', $arrBkColor[$i]) FileCopy($DlPath & 'temp.ini', $Path, 1) EndIf Next WEnd EndFunc ;==>_MainLoop Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam Local $tNMHDR, $hWndFrom, $iCode, $idCommand Local $sDrive = "", $sDir = "", $sFilename = "", $sExtension = "" Local $iSelect, $iIndex, $Path, $Path2, $sFileSaveDialog, $aArray, $cmb Local $hwndLv = GUICtrlGetHandle($ListView1) Local $hwndLv2 = GUICtrlGetHandle($ListView2) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = DllStructGetData($tNMHDR, 'hWndFrom') $iCode = DllStructGetData($tNMHDR, 'Code') Switch $hWndFrom Case $HwndGalleryLv Switch $iCode Case $NM_CLICK $iSelect = _GUICtrlListView_GetSelectedIndices($HwndGalleryLv, True) If $iSelect[0] > 0 Then $iIndex = $iSelect[1] $Path = _GUICtrlListView_GetItemText($HwndGalleryLv, $iIndex, 1) If FileExists($Path) Then Local $Crop, $sOutFile $sOutFile = $Path $Crop = _Crop2($Path, $DlPath & 'GalleryCropdPic.bmp', $GalleryLvPicW, $GalleryLvPicH) If Not @error Then $sOutFile = $Crop GUICtrlSetImage($GalleryLvPic, '') GUICtrlSetImage($GalleryLvPic, $sOutFile) EndIf EndIf EndSwitch Case $hwndLv2 Switch $iCode Case $NM_RCLICK $iSelect = _GUICtrlListView_GetSelectedIndices($ListView2, True) If $iSelect[0] > 0 Then $iIndex = $iSelect[1] $Path = _GUICtrlListView_GetItemText($ListView2, $iIndex, 0) $Path2 = _Lv2SearchFullPathWp($Path) $idCommand = _GUICtrlMenu_TrackPopupMenu(GUICtrlGetHandle($MenuListView2), $hWnd, -1, -1, 1, 1, 2) Switch $idCommand Case $MenuListView2_Appliquer _Lv2DBClK() Case $MenuListView2_Supprimer If Not FileExists($Path2) Then $Path = _GUICtrlListView_GetItemText($ListView2, $iIndex, 0) If FileExists($DlPath & $Path & '.deskthemepack') Then If MsgBox(4, $AppTitle, 'Supprimer : ' & @CRLF & $DlPath & $Path & '.deskthemepack') = 6 Then FileDelete($DlPath & $Path & '.deskthemepack') _Lv2SetDlList() EndIf EndIf Else If FileExists($Path2) Then If MsgBox(4, $AppTitle, 'Supprimer : ' & @CRLF & $Path2) = 6 Then FileDelete($Path2) _GUICtrlListView_DeleteItemsSelected($ListView2) EndIf EndIf EndIf Case $MenuListView2_Ajouter If Not FileExists($DlPath & $Path & '.deskthemepack') Then _PathSplit($Path2, $sDrive, $sDir, $sFilename, $sExtension) _Lv2AddPicToTheme($Path2) EndIf Case $MenuListView2_Extraire If FileExists($DlPath & $Path & '.deskthemepack') Then $sFileSaveDialog = FileSelectFolder("", @DesktopDir, '') If Not @error Then DirCreate($sFileSaveDialog & '\' & $Path) $cmb = 'expand -F:* ' & '"' & $DlPath & $Path & '.deskthemepack' & '"' & ' "' & $sFileSaveDialog & '\' & $Path & '" > c:\log.txt' RunWait(@ComSpec & " /c" & $cmb, "", @SW_HIDE) EndIf Else If FileExists($Path2) Then _PathSplit($Path2, $sDrive, $sDir, $sFilename, $sExtension) $sFileSaveDialog = FileSaveDialog('Sauvegarder sous : ', "::{450D8FBA-AD25-11D0-98A8-0800361B1103}", "Scripts (*.au3)", $FD_PATHMUSTEXIST, $sFilename & $sExtension) If Not @error Then FileCopy($Path2, $sFileSaveDialog, 1) EndIf EndIf EndSwitch Else $idCommand = _GUICtrlMenu_TrackPopupMenu(GUICtrlGetHandle($Menu2ListView2), $hWnd, -1, -1, 1, 1, 2) Switch $idCommand Case $Menu2ListView2_Ajouter If _GUICtrlListView_GetItemText($ListView1, _ListView_GetItemSelected($ListView1), 0) <> $DlItem Then _Lv2AddPicToTheme(_GUICtrlListView_GetItemText($ListView1, _ListView_GetItemSelected($ListView1), 1)) EndIf EndSwitch EndIf Case $NM_DBLCLK _Lv2DBClK() Case $NM_CLICK $iSelect = _GUICtrlListView_GetSelectedIndices($ListView2, True) If $iSelect[0] > 0 Then $iIndex = $iSelect[1] $Path = _GUICtrlListView_GetItemText($ListView2, $iIndex, 0) $Path = _Lv2SearchFullPathWp($Path) If FileExists($Path) Then _ActuPreview($Path) EndIf EndSwitch Case $hwndLv Switch $iCode Case $NM_RCLICK $iSelect = _GUICtrlListView_GetSelectedIndices($ListView1, True) If $iSelect[0] > 0 Then $iIndex = $iSelect[1] $Path = _GUICtrlListView_GetItemText($ListView1, $iIndex, 1) _PathSplit($Path, $sDrive, $sDir, $sFilename, $sExtension) $idCommand = _GUICtrlMenu_TrackPopupMenu(GUICtrlGetHandle($MenuListView), $hWnd, -1, -1, 1, 1, 2) Switch $idCommand Case $MenuListView_Appliquer _Lv1DBCLK() Case $MenuListView_Create $CreateTheme = True Case $MenuListView_Ajouter If _GUICtrlListView_GetItemText($ListView1, $iIndex, 0) <> $DlItem Then _Lv1AddPicToTheme($Path) Case $MenuListView_Extraire If FileExists($sDrive & $sDir) And FileGetAttrib($sDrive & $sDir) = 'D' And $sDrive & $sDir <> $ThemeSearchPath[1] And $sDrive & $sDir <> $ThemeSearchPath[0] Then $sFileSaveDialog = FileSelectFolder("", @DesktopDir, '') If Not @error Then $sFileSaveDialog = $sFileSaveDialog & '\' & $sFilename DirCreate($sFileSaveDialog) $aArray = _FileListToArrayRec($sDrive & $sDir, $sFilter, 1, 1, 1, 2) For $i = 1 To UBound($aArray) - 1 _PathSplit($aArray[$i], $sDrive, $sDir, $sFilename, $sExtension) If FileExists($aArray[$i]) Then FileCopy($aArray[$i], $sFileSaveDialog & '\' & $sFilename & $sExtension, 1) Next EndIf EndIf Case $MenuListView_Supprimer If FileExists($sDrive & $sDir) And FileGetAttrib($sDrive & $sDir) = 'D' And $sDrive & $sDir <> $ThemeSearchPath[1] And $sDrive & $sDir <> $ThemeSearchPath[0] Then If MsgBox(4, $AppTitle, 'Supprimer : ' & @CRLF & $sDrive & $sDir) = 6 Then DirRemove($sDrive & $sDir, 1) $Path = _LvSetCurrentTheme() _GUICtrlSetStateOptions(64) _SetOptions(_GUICtrlListView_GetItemText($ListView1, $Path, 1)) ElseIf FileExists($sDrive & $sDir) And FileGetAttrib($sDrive & $sDir) = 'D' And $sDrive & $sDir <> $ThemeSearchPath[1] And $sDrive & $sDir = $ThemeSearchPath[0] Then If MsgBox(4, $AppTitle, 'Supprimer : ' & @CRLF & $Path) = 6 Then FileDelete($Path) $Path = _LvSetCurrentTheme() _GUICtrlSetStateOptions(64) _SetOptions(_GUICtrlListView_GetItemText($ListView1, $Path, 1)) EndIf EndSwitch Else $idCommand = _GUICtrlMenu_TrackPopupMenu(GUICtrlGetHandle($Menu2ListView), $hWnd, -1, -1, 1, 1, 2) Switch $idCommand Case $Menu2ListView_Create $CreateTheme = True EndSwitch EndIf Case $NM_CLICK $iSelect = _GUICtrlListView_GetSelectedIndices($ListView1, True) If $iSelect[0] > 0 Then GUICtrlSetState($PicSliderV, $GUI_DISABLE + $GUI_HIDE) GUICtrlSetState($PicSliderH, $GUI_DISABLE + $GUI_HIDE) $iIndex = $iSelect[1] $Path = _GUICtrlListView_GetItemText($ListView1, $iIndex, 1) Switch $Path Case $DlItem _Lv2SetDlList() Case Else _Lv2Set($Path) EndSwitch If RegRead('HKCU\Software\Microsoft\Windows\CurrentVersion\Themes', 'CurrentTheme') = $Path Then _GUICtrlSetStateOptions(64) Else _GUICtrlSetStateOptions(128) EndIf If _GUICtrlListView_GetItemText($ListView1, $iIndex, 0) <> $DlItem Then _SetOptions($Path) EndIf EndIf Case $NM_DBLCLK _Lv1DBCLK() EndSwitch EndSwitch EndFunc ;==>_WM_NOTIFY Func _GetThemeFile() Local $iIndex, $Path, $iSelect = _GUICtrlListView_GetSelectedIndices($ListView1, True) If $iSelect[0] > 0 Then $iIndex = $iSelect[1] $Path = _GUICtrlListView_GetItemText($ListView1, $iIndex, 1) FileDelete($DlPath & 'temp.ini') FileCopy($Path, $DlPath & 'temp.ini', 1) Return $Path EndIf EndFunc ;==>_GetThemeFile Func _SetOptions($Path) FileDelete($DlPath & 'temp.ini') FileCopy($Path, $DlPath & 'temp.ini', 1) GUICtrlSetState($CheckDarkStyle, 4) GUICtrlSetData($CmbInterval, $data, IniRead($DlPath & 'temp.ini', 'Slideshow', 'Interval', '') / 60000) If IniRead($DlPath & 'temp.ini', 'Slideshow', 'Shuffle', '') = 1 Then GUICtrlSetState($CheckRandom, 1) Else GUICtrlSetState($CheckRandom, 4) EndIf Local $sDefault Switch IniRead($DlPath & 'temp.ini', 'Control Panel\Desktop', 'PicturePosition', '') Case 5 $sDefault = 'Etendre' Case 3 $sDefault = 'Ajuster' Case 2 $sDefault = 'Etirer' Case 1 $sDefault = 'Vignette' Case 0 $sDefault = 'Centrer' Case 4 $sDefault = 'Remplir' EndSwitch GUICtrlSetData($CmbAdjust, '') GUICtrlSetData($CmbAdjust, 'Remplir|Ajuster|Etirer|Vignette|Centrer|Etendre', $sDefault) Local $BkColor = IniRead($DlPath & 'temp.ini', 'VisualStyles', 'ColorizationColor', '') GUICtrlSetBkColor($LblBkColor, "0x" & Hex($BkColor, 6)) If $countBkColor > UBound($arrLblBkColor) - 1 Then $countBkColor = 0 Local $find = False For $i = 0 To UBound($arrLblBkColor) - 1 If $arrBkColor[$i] = $BkColor Then $find = True EndIf Next If Not $find Then $arrBkColor[$countBkColor] = $BkColor GUICtrlSetBkColor($arrLblBkColor[$countBkColor], "0x" & Hex($BkColor, 6)) $countBkColor += 1 EndIf If IniRead($DlPath & 'temp.ini', 'VisualStyles', 'AutoColorization', '') = 0 Then GUICtrlSetState($CheckAutoColorization, 4) Else GUICtrlSetState($CheckAutoColorization, 1) EndIf If _IsChecked($CheckAutoColorization) Then GUICtrlSetState($LblBkColor, 128) For $i = 0 To UBound($arrLblBkColor) - 1 GUICtrlSetState($arrLblBkColor[$i], 128) Next EndIf If IniRead($DlPath & 'temp.ini', 'VisualStyles', 'Transparency', '') = 0 Then GUICtrlSetState($CheckTranasparence, 4) Else GUICtrlSetState($CheckTranasparence, 1) EndIf If RegRead('HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize', 'ColorPrevalence') = 0 Then GUICtrlSetState($CheckColorPrevalenceMenu, 4) Else GUICtrlSetState($CheckColorPrevalenceMenu, 1) EndIf If RegRead('HKCU\SOFTWARE\Microsoft\Windows\DWM', 'ColorPrevalence') = 0 Then GUICtrlSetState($CheckColorPrevalenceTask, 4) Else GUICtrlSetState($CheckColorPrevalenceTask, 1) EndIf EndFunc ;==>_SetOptions Func _GUICtrlSetStateOptions($State) GUICtrlSetState($CmbInterval, $State) GUICtrlSetState($CheckRandom, $State) GUICtrlSetState($CmbAdjust, $State) GUICtrlSetState($ChecDefaultCursorSounds, $State) GUICtrlSetState($CheckAutoColorization, $State) GUICtrlSetState($LblBkColor, $State) For $i = 0 To UBound($arrLblBkColor) - 1 GUICtrlSetState($arrLblBkColor[$i], $State) Next GUICtrlSetState($CheckTranasparence, $State) GUICtrlSetState($CheckColorPrevalenceMenu, $State) GUICtrlSetState($CheckColorPrevalenceTask, $State) GUICtrlSetState($CheckDarkStyle, $State) GUICtrlSetState($BtnRefresh, $State) GUICtrlSetState($BtnRefreshExplorer, $State) If $State = 64 Then GUICtrlSetData($BtnRefresh, "Applquer les modifications " & _GUICtrlListView_GetItemText($ListView1, _ListView_GetItemSelected($ListView1), 0)) If $State = 128 Then GUICtrlSetData($BtnRefresh, "Le theme n'a pas etait appliqeur") EndFunc ;==>_GUICtrlSetStateOptions Func _CheckIfRefreshExplorer() If _IsChecked($CheckTranasparence) Then Return True If _IsChecked($CheckColorPrevalenceMenu) Then Return True ;~ If _IsChecked($CheckColorPrevalenceTask) Then Return True ;~ If _IsChecked($CheckDarkStyle) Then Return True Return False EndFunc ;==>_CheckIfRefreshExplorer Func _RefreshExplorer() ; Restart Explorer Dim $strComputer, $objWMIService, $colProcess, $objProcess, $oShell $strComputer = "." ;Get WMI object $objWMIService = ObjGet("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" _ & $strComputer & "\root\cimv2") $colProcess = $objWMIService.ExecQuery _ ("Select * from Win32_Process Where Name = 'explorer.exe'") For $objProcess In $colProcess $objProcess.Terminate() Next $oShell = ObjCreate("WScript.Shell") Sleep(1000) $oShell.Run(@HomeDrive & "\windows\explorer.exe") EndFunc ;==>_RefreshExplorer Func _BtnRefresh() Local $sDrive = "", $sDir = "", $sFilename = "", $sExtension = "" Local $GetThemeFile, $iIndex, $Path, $iSelect = _GUICtrlListView_GetSelectedIndices($ListView1, True) If $iSelect[0] > 0 Then $iIndex = $iSelect[1] $Path = _GUICtrlListView_GetItemText($ListView1, $iIndex, 1) _PathSplit($Path, $sDrive, $sDir, $sFilename, $sExtension) If _IsChecked($CheckTranasparence) Then RegWrite('HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize', 'EnableTransparency', 'REG_DWORD', 1) Else RegWrite('HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize', 'EnableTransparency', 'REG_DWORD', 0) EndIf If _IsChecked($CheckColorPrevalenceMenu) Then RegWrite('HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize', 'ColorPrevalence', 'REG_DWORD', 1) Else RegWrite('HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize', 'ColorPrevalence', 'REG_DWORD', 0) EndIf If _IsChecked($CheckColorPrevalenceTask) Then RegWrite('HKCU\SOFTWARE\Microsoft\Windows\DWM', 'ColorPrevalence', 'REG_DWORD', 1) Else RegWrite('HKCU\SOFTWARE\Microsoft\Windows\DWM', 'ColorPrevalence', 'REG_DWORD', 0) EndIf If _IsChecked($CheckDarkStyle) Then RegWrite('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize', 'AppsUseLightTheme', 'REG_DWORD', 0) RegWrite('HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize', 'AppsUseLightTheme', 'REG_DWORD', 0) Else RegDelete('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize', 'AppsUseLightTheme') RegDelete('HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize', 'AppsUseLightTheme') EndIf If ShellExecute($Path, "", $sDrive & $sDir, '', @SW_HIDE) <> 0 Then WinWait('Paramètres') WinClose("Paramètres") EndIf EndIf EndFunc ;==>_BtnRefresh Func _LvSetCurrentTheme() Local $sVal1, $sFind = '' _Lv1Set() For $j = 0 To _GUICtrlListView_GetItemCount($ListView1) - 1 $sVal1 = _GUICtrlListView_GetItemText($ListView1, $j, 1) If RegRead('HKCU\Software\Microsoft\Windows\CurrentVersion\Themes', 'CurrentTheme') = $sVal1 Then $sFind = $j ExitLoop EndIf Next If $sFind = '' Then _Lv2Set(_GUICtrlListView_GetItemText($ListView1, 1, 1)) _GUICtrlListView_SetItemSelected($ListView1, 1) $sFind = 1 If Not FileExists(RegRead('HKCU\Software\Microsoft\Windows\CurrentVersion\Themes', 'CurrentTheme')) Then If ShellExecute(_GUICtrlListView_GetItemText($ListView1, 1, 1), "", '', '', @SW_HIDE) <> 0 Then WinWait('Paramètres') WinClose("Paramètres") $sFind = _LvSetCurrentTheme() EndIf EndIf Else _Lv2Set(_GUICtrlListView_GetItemText($ListView1, $sFind, 1)) _GUICtrlListView_SetItemSelected($ListView1, $sFind) EndIf Return $sFind EndFunc ;==>_LvSetCurrentTheme Func _Lv1DBCLK() Local $iSelect, $iIndex, $Path Local $sDrive = "", $sDir = "", $sFilename = "", $sExtension = "" $iSelect = _GUICtrlListView_GetSelectedIndices($ListView1, True) If $iSelect[0] > 0 Then $iIndex = $iSelect[1] $Path = _GUICtrlListView_GetItemText($ListView1, $iIndex, 1) If _GUICtrlListView_GetItemText($ListView1, $iIndex, 0) = $DlItem Then Return _GUICtrlSetStateOptions(64) _PathSplit($Path, $sDrive, $sDir, $sFilename, $sExtension) If FileExists($Path) Then If ShellExecute($Path, "", $sDrive & $sDir, '', @SW_HIDE) <> 0 Then WinWait('Paramètres') WinClose("Paramètres") _LvSetCurrentTheme() _GUICtrlSetStateOptions(64) _SetOptions($Path) EndIf EndIf EndIf EndFunc ;==>_Lv1DBCLK Func _Lv1AddPicToTheme($sPath) Local $sDrive = "", $sDir = "", $sFilename = "", $sExtension = "" Local $aPath, $sFileSaveDialog _PathSplit($sPath, $sDrive, $sDir, $sFilename, $sExtension) Switch $sDrive & $sDir Case $ThemeSearchPath[1] $aPath = @WindowsDir & '\Web\Wallpaper\' & StringReplace($sFilename, 'aero', 'windows') Case Else $aPath = $sDrive & $sDir EndSwitch $sFileSaveDialog = FileSaveDialog('Sellecitionner un fond : ', "::{450D8FBA-AD25-11D0-98A8-0800361B1103}", "Jpg (*.jpg)|Bmp (*.bmp)|Tous (*)", $FD_PATHMUSTEXIST) If Not @error Then _PathSplit($sFileSaveDialog, $sDrive, $sDir, $sFilename, $sExtension) If _ReadExifData($sFileSaveDialog, $DlPath & 'Theme changeur WpRotate.bmp', 0) Then ;~ _ScaleImage($DlPath & 'Theme changeur WpRotate.bmp', $aPath & '\' & $sFilename & $sExtension, @DesktopWidth, @DesktopHeight) ;~ If @error Then FileCopy($sFileSaveDialog, $aPath & '\' & $sFilename & $sExtension) FileCopy($DlPath & 'Theme changeur WpRotate.bmp', $aPath & '\' & $sFilename & $sExtension) Else ;~ _ScaleImage($sFileSaveDialog, $aPath & '\' & $sFilename & $sExtension, @DesktopWidth, @DesktopHeight) ;~ If @error Then FileCopy($sFileSaveDialog, $aPath & '\' & $sFilename & $sExtension) FileCopy($sFileSaveDialog, $aPath & '\' & $sFilename & $sExtension) EndIf EndIf _LvSetCurrentTheme() EndFunc ;==>_Lv1AddPicToTheme Func _Lv1Set($sPath = $ThemeSearchPath) Local $sDrive = "", $sDir = "", $sFilename = "", $sExtension = "" _GUICtrlListView_DeleteAllItems($ListView1) GUICtrlCreateListViewItem($DlItem & '|' & $DlItem, $ListView1) Local $aArray For $A = 0 To UBound($sPath) - 1 $aArray = _FileListToArrayRec($sPath[$A], "*.theme", 1, 1, 1, 2) For $i = 1 To UBound($aArray) - 1 _PathSplit($aArray[$i], $sDrive, $sDir, $sFilename, $sExtension) If $sFilename = 'custom' Then ContinueLoop GUICtrlCreateListViewItem($sFilename & '|' & $aArray[$i], $ListView1) If RegRead('HKCU\Software\Microsoft\Windows\CurrentVersion\Themes', 'CurrentTheme') = $aArray[$i] Then GUICtrlSetColor(-1, 0x00CD00) Next Next EndFunc ;==>_Lv1Set Func _Lv2DBClK() Local $iSelect, $Url, $iIndex, $Path, $Path2, $aArray, $cmb Local $sDrive = "", $sDir = "", $sFilename = "", $sExtension = "" $iSelect = _GUICtrlListView_GetSelectedIndices($ListView2, True) If $iSelect[0] > 0 Then $iIndex = $iSelect[1] $Path = _GUICtrlListView_GetItemText($ListView2, $iIndex, 0) $Url = _GUICtrlListView_GetItemText($ListView2, $iIndex, 1) $Path2 = _Lv2SearchFullPathWp($Path) If FileExists($Path2) Then _ChangeWallpaperEx(0, $Path2) Else If Not FileExists($DlPath & $Path & '.deskthemepack') Then If $Url <> '' Then _InetGet($Url, $DlPath & $Path & '.deskthemepack') If FileExists($DlPath & $Path & '.deskthemepack') Then Local $Expath = $DlPath & $Path & '.deskthemepack' Local $Exoutpath = $DlPath & '\Nouveau dossier' If FileExists($Exoutpath) Then DirRemove($Exoutpath, 1) If Not FileExists($Exoutpath) Then DirCreate($Exoutpath) $cmb = 'expand -F:* ' & '"' & $Expath & '"' & ' "' & $Exoutpath & '"' RunWait(@ComSpec & " /c" & $cmb, "", @SW_HIDE) IniWrite($Path_Ini_Config, $Path, 'dl', $DlPath & $Path & '.deskthemepack') $aArray = _FileListToArrayRec($Exoutpath, "*.theme", 1, 1, 1, 2) For $i = 1 To UBound($aArray) - 1 _PathSplit($aArray[$i], $sDrive, $sDir, $sFilename, $sExtension) If $sExtension = ".theme" Then IniWrite($Path_Ini_Config, $Path, 'theme', $sFilename & $sExtension) ExitLoop EndIf Next _PathSplit($DlPath & $Path & '.deskthemepack', $sDrive, $sDir, $sFilename, $sExtension) If ShellExecute($DlPath & $Path & '.deskthemepack', "", $sDrive & $sDir, '', @SW_HIDE) <> 0 Then WinWait('Paramètres') WinClose("Paramètres") _Lv1Set() If IniRead($Path_Ini_Config, $Path, 'theme', '') <> '' Then $iSelect = _Lv2SearchItemTheme(IniRead($Path_Ini_Config, $Path, 'theme', '')) If Not @error And $iSelect <> '' Then _GUICtrlListView_SetItemSelected($ListView1, $iSelect) _Lv2Set(_GUICtrlListView_GetItemText($ListView1, $iSelect, 1)) _GUICtrlSetStateOptions(64) _SetOptions(_GUICtrlListView_GetItemText($ListView1, $iSelect, 1)) EndIf Else $iSelect = _Lv2SearchItemTheme($Path) If Not @error And $iSelect <> '' Then _GUICtrlListView_SetItemSelected($ListView1, $iSelect) _Lv2Set(_GUICtrlListView_GetItemText($ListView1, $iSelect, 1)) _GUICtrlSetStateOptions(64) _SetOptions(_GUICtrlListView_GetItemText($ListView1, $iSelect, 1)) EndIf EndIf EndIf EndIf EndIf Else If ShellExecute($DlPath & $Path & '.deskthemepack', "", $sDrive & $sDir, '', @SW_HIDE) <> 0 Then WinWait('Paramètres') WinClose("Paramètres") EndIf _Lv1Set() If IniRead($Path_Ini_Config, $Path, 'theme', '') <> '' Then $iSelect = _Lv2SearchItemTheme(IniRead($Path_Ini_Config, $Path, 'theme', '')) If Not @error And $iSelect <> '' Then _GUICtrlListView_SetItemSelected($ListView1, $iSelect) _Lv2Set(_GUICtrlListView_GetItemText($ListView1, $iSelect, 1)) _GUICtrlSetStateOptions(64) _SetOptions(_GUICtrlListView_GetItemText($ListView1, $iSelect, 1)) EndIf Else $iSelect = _Lv2SearchItemTheme($Path) If Not @error And $iSelect <> '' Then _GUICtrlListView_SetItemSelected($ListView1, $iSelect) _Lv2Set(_GUICtrlListView_GetItemText($ListView1, $iSelect, 1)) _GUICtrlSetStateOptions(64) _SetOptions(_GUICtrlListView_GetItemText($ListView1, $iSelect, 1)) EndIf EndIf EndIf EndIf EndIf EndFunc ;==>_Lv2DBClK Func _Lv2Set($sPath) Local $aArray, $sDrive = "", $sDir = "", $sFilename = "", $sExtension = "" _GUICtrlListView_DeleteAllItems($ListView2) _PathSplit($sPath, $sDrive, $sDir, $sFilename, $sExtension) Local $aPath _PathSplit($sPath, $sDrive, $sDir, $sFilename, $sExtension) Switch $sDrive & $sDir Case $ThemeSearchPath[1] $aPath = @WindowsDir & '\Web\Wallpaper\' & StringReplace($sFilename, 'aero', 'windows') Case Else $aPath = $sDrive & $sDir EndSwitch $aArray = _FileListToArrayRec($aPath, $sFilter, 1, 1, 1, 2) $ArrFullPath = 0 Dim $ArrFullPath[0] For $i = 1 To UBound($aArray) - 1 _PathSplit($aArray[$i], $sDrive, $sDir, $sFilename, $sExtension) _ArrayAdd($ArrFullPath, $aArray[$i]) GUICtrlCreateListViewItem($sFilename, $ListView2) Next If UBound($ArrFullPath) > 0 Then _GUICtrlListView_SetItemSelected($ListView2, 0) If FileExists($ArrFullPath[0]) Then _ActuPreview($ArrFullPath[0]) EndIf EndFunc ;==>_Lv2Set Func _Lv2SetDlList() _GUICtrlListView_DeleteAllItems($ListView2) Local $file = $DlPath & 'Themes.dropbox' Local $split, $line, $count $ArrFullPath = 0 For $j = 1 To _FileCountLines($file) $line = FileReadLine($file, $j) $split = StringSplit($line, '/') $count = UBound($split) - 1 If StringRight($split[$count], 5) = "?dl=1" Then $split = StringTrimRight($split[$count], 5) Else $split = $split[$count] EndIf $split = StringSplit($split, '.') GUICtrlCreateListViewItem($split[1] & '|' & $line, $ListView2) If FileExists($DlPath & $split[1] & '.deskthemepack') Then GUICtrlSetColor(-1, 0x00CD00) Next EndFunc ;==>_Lv2SetDlList Func _Lv2SearchItemTheme($search) Local $sVal1 Local $sDrive = "", $sDir = "", $sFilename = "", $sExtension = "" For $j = 0 To _GUICtrlListView_GetItemCount($ListView1) - 1 $sVal1 = _GUICtrlListView_GetItemText($ListView1, $j, 1) _PathSplit($sVal1, $sDrive, $sDir, $sFilename, $sExtension) If StringInStr($search, $sDrive) Then Return $j EndIf If StringInStr($search, $sDir) Then Return $j EndIf If StringInStr($search, $sFilename & $sExtension) Then Return $j EndIf If StringInStr($search, $sFilename) Then Return $j EndIf Next Return SetError(1) EndFunc ;==>_Lv2SearchItemTheme Func _Lv2SearchFullPathWp($search) Local $sDrive = "", $sDir = "", $sFilename = "", $sExtension = "" For $i = 0 To UBound($ArrFullPath) - 1 _PathSplit($ArrFullPath[$i], $sDrive, $sDir, $sFilename, $sExtension) If $sFilename = $search Then Return $ArrFullPath[$i] Next Return False EndFunc ;==>_Lv2SearchFullPathWp Func _Lv2AddPicToTheme($sPath) Local $sDrive = "", $sDir = "", $sFilename = "", $sExtension = "" Local $aPath, $sFileSaveDialog _PathSplit($sPath, $sDrive, $sDir, $sFilename, $sExtension) Switch $sDrive & $sDir Case $ThemeSearchPath[1] $aPath = @WindowsDir & '\Web\Wallpaper\' & StringReplace($sFilename, 'aero', 'windows') Case Else $aPath = $sDrive & $sDir EndSwitch $sFileSaveDialog = FileSaveDialog('Sellecitionner un fond : ', "::{450D8FBA-AD25-11D0-98A8-0800361B1103}", "Jpg (*.jpg)|Bmp (*.bmp)|Tous (*)", $FD_PATHMUSTEXIST) If Not @error Then _PathSplit($sFileSaveDialog, $sDrive, $sDir, $sFilename, $sExtension) If _ReadExifData($sFileSaveDialog, $DlPath & 'Theme changeur WpRotate.bmp', 0) Then ;~ _ScaleImage($DlPath & 'Theme changeur WpRotate.bmp', $aPath & '\' & $sFilename & $sExtension, @DesktopWidth, @DesktopHeight) ;~ If @error Then FileCopy($sFileSaveDialog, $aPath & '\' & $sFilename & $sExtension) FileCopy($DlPath & 'Theme changeur WpRotate.bmp', $aPath & '\' & $sFilename & $sExtension) Else ;~ _ScaleImage($sFileSaveDialog, $aPath & '\' & $sFilename & $sExtension, @DesktopWidth, @DesktopHeight) ;~ If @error Then FileCopy($sFileSaveDialog, $aPath & '\' & $sFilename & $sExtension) FileCopy($sFileSaveDialog, $aPath & '\' & $sFilename & $sExtension) EndIf _Lv2Set(_GUICtrlListView_GetItemText($ListView1, _ListView_GetItemSelected($ListView1), 1)) EndIf EndFunc ;==>_Lv2AddPicToTheme Func _CreateCustomizerTheme() Local $s1 = _CreateNewFolder(@UserProfileDir & '\AppData\Local\Microsoft\Windows\Themes\', 'WPT Theme') DirCreate($s1[0] & '\DesktopBackground') _CreateCustomizerThemeAddPic($s1[0] & '\DesktopBackground\') If @error Then DirRemove($s1[0], 1) Return EndIf Local $sThemeName = $s1[1] & '.theme' Local $defIni = $Path_Ini_DefaultTheme FileCopy($defIni, $DlPath & 'TempWPTTheme.ini', 1) IniWrite($DlPath & 'TempWPTTheme.ini', 'Theme', 'DisplayName', $s1[1]) Local $aArray = _FileListToArrayRec($s1[0] & '\DesktopBackground\', $sFilter, 1, 1, 0, 2) If UBound($aArray) > 0 Then IniWrite($DlPath & 'TempWPTTheme.ini', 'Control Panel\Desktop', 'Wallpaper', $aArray[1]) IniWrite($DlPath & 'TempWPTTheme.ini', 'Control Panel\Desktop', 'WallpaperStyle', 10) IniWrite($DlPath & 'TempWPTTheme.ini', 'Control Panel\Desktop', 'TileWallpaper', 0) IniWrite($DlPath & 'TempWPTTheme.ini', 'Control Panel\Desktop', 'PicturePosition', 0) IniWrite($DlPath & 'TempWPTTheme.ini', 'Control Panel\Desktop', 'MultimonBackgrounds', 0) IniWrite($DlPath & 'TempWPTTheme.ini', 'Control Panel\Desktop', 'Pattern', '') IniWrite($DlPath & 'TempWPTTheme.ini', 'Slideshow', 'ImagesRootPath', $s1[0] & '\DesktopBackground\') IniWrite($DlPath & 'TempWPTTheme.ini', 'Slideshow', 'Shuffle', 1) IniWrite($DlPath & 'TempWPTTheme.ini', 'Slideshow', 'Interval', 600000) FileCopy($DlPath & 'TempWPTTheme.ini', $s1[0] & '\' & $sThemeName) If FileExists($s1[0] & '\' & $sThemeName) Then If ShellExecute($s1[0] & '\' & $sThemeName, "", '', '', @SW_HIDE) <> 0 Then WinWait('Paramètres') WinClose("Paramètres") _LvSetCurrentTheme() _SetOptions($s1[0] & '\' & $sThemeName) EndIf EndIf EndFunc ;==>_CreateCustomizerTheme Func _CreateCustomizerThemeAddPic($sPath) Local $FinalName If StringRight($sPath, 1) == "\" Then $sPath = $sPath Else $sPath = $sPath & '\' EndIf Local $aFileToAdd, $sWorkingDir, $sImagePath = _Gallery() _Upd('_CreateCustomizerThemeAddPic') If $sImagePath <> '' Then Local $sDrive = "", $sDir = "", $sFilename = "", $sExtension = "" If Not FileExists($sImagePath) And StringInStr($sImagePath, ';') Then $aFileToAdd = StringSplit($sImagePath, ';') For $i = 1 To UBound($aFileToAdd) - 1 _PathSplit($aFileToAdd[$i], $sDrive, $sDir, $sFilename, $sExtension) If FileExists($sPath & $sFilename & $sExtension) Then If MsgBox(4, $AppTitle, 'La photo : ' & $sFilename & $sExtension & ' existe deja' & @CRLF & ' Voullez vous la remplacer ?') == 6 Then If $GalleryCheckCrop = 1 Then If _ReadExifData($aFileToAdd[$i], $DlPath & 'Theme changeur WpRotate.bmp', 0) Then _Crop($DlPath & 'Theme changeur WpRotate.bmp', $sPath & $sFilename & $sExtension, @DesktopWidth, @DesktopHeight) If @error Then FileCopy($DlPath & 'Theme changeur WpRotate.bmp', $sPath & $sFilename & $sExtension, 1) Else _Crop($aFileToAdd[$i], $sPath & $sFilename & $sExtension, @DesktopWidth, @DesktopHeight) If @error Then FileCopy($aFileToAdd[$i], $sPath & $sFilename & $sExtension, 1) EndIf Else FileCopy($aFileToAdd[$i], $sPath & $sFilename & $sExtension, 1) EndIf Else If $GalleryCheckCrop = 1 Then If _ReadExifData($aFileToAdd[$i], $DlPath & 'Theme changeur WpRotate.bmp', 0) Then $FinalName = _GetNewFileName($sFilename & $sExtension, $sPath) _Crop($DlPath & 'Theme changeur WpRotate.bmp', $sPath & $FinalName, @DesktopWidth, @DesktopHeight) If @error Then FileCopy($DlPath & 'Theme changeur WpRotate.bmp', $sPath & $FinalName) Else $FinalName = _GetNewFileName($sFilename & $sExtension, $sPath) _Crop($aFileToAdd[$i], $sPath & $FinalName, @DesktopWidth, @DesktopHeight) If @error Then FileCopy($aFileToAdd[$i], $sPath & $FinalName) EndIf Else $FinalName = _GetNewFileName($sFilename & $sExtension, $sPath) FileCopy($aFileToAdd[$i], $sPath & $FinalName) EndIf EndIf Else If $GalleryCheckCrop = 1 Then If _ReadExifData($aFileToAdd[$i], $DlPath & 'Theme changeur WpRotate.bmp', 0) Then _Crop($DlPath & 'Theme changeur WpRotate.bmp', $sPath & $sFilename & $sExtension, @DesktopWidth, @DesktopHeight) If @error Then FileCopy($DlPath & 'Theme changeur WpRotate.bmp', $sPath & $sFilename & $sExtension, 1) Else _Crop($aFileToAdd[$i], $sPath & $sFilename & $sExtension, @DesktopWidth, @DesktopHeight) If @error Then FileCopy($aFileToAdd[$i], $sPath & $sFilename & $sExtension, 1) EndIf Else FileCopy($aFileToAdd[$i], $sPath & $sFilename & $sExtension, 1) EndIf EndIf Next Else _PathSplit($sImagePath, $sDrive, $sDir, $sFilename, $sExtension) If FileExists($sPath & $sFilename & $sExtension) Then If MsgBox(4, $AppTitle, 'La photo : ' & $sFilename & $sExtension & ' existe deja' & @CRLF & ' Voullez vous la remplacer ?') == 6 Then If $GalleryCheckCrop = 1 Then If _ReadExifData($sPath & $sFilename & $sExtension, $DlPath & 'Theme changeur WpRotate.bmp', 0) Then _Crop($DlPath & 'Theme changeur WpRotate.bmp', $sPath & $sFilename & $sExtension, @DesktopWidth, @DesktopHeight) If @error Then FileCopy($DlPath & 'Theme changeur WpRotate.bmp', $sPath & $sFilename & $sExtension, 1) Else _Crop($sPath & $sFilename & $sExtension, $sPath & $sFilename & $sExtension, @DesktopWidth, @DesktopHeight) If @error Then FileCopy($sPath & $sFilename & $sExtension, $sPath & $sFilename & $sExtension, 1) EndIf Else FileCopy($sPath & $sFilename & $sExtension, $sPath & $sFilename & $sExtension, 1) EndIf Else If $GalleryCheckCrop = 1 Then If _ReadExifData($sPath & $sFilename & $sExtension, $DlPath & 'Theme changeur WpRotate.bmp', 0) Then $FinalName = _GetNewFileName($sFilename & $sExtension, $sPath) _Crop($DlPath & 'Theme changeur WpRotate.bmp', $sPath & $FinalName, @DesktopWidth, @DesktopHeight) If @error Then FileCopy($DlPath & 'Theme changeur WpRotate.bmp', $sPath & $FinalName) Else $FinalName = _GetNewFileName($sFilename & $sExtension, $sPath) _Crop($sPath & $sFilename & $sExtension, $sPath & $FinalName, @DesktopWidth, @DesktopHeight) If @error Then FileCopy($sPath & $sFilename & $sExtension, $sPath & $FinalName) EndIf Else $FinalName = _GetNewFileName($sFilename & $sExtension, $sPath) FileCopy($sPath & $sFilename & $sExtension, $sPath & $FinalName) EndIf EndIf Else If $GalleryCheckCrop = 1 Then If _ReadExifData($sImagePath, $DlPath & 'Theme changeur WpRotate.bmp', 0) Then _Crop($DlPath & 'Theme changeur WpRotate.bmp', $sPath & $sFilename & $sExtension, @DesktopWidth, @DesktopHeight) If @error Then FileCopy($DlPath & 'Theme changeur WpRotate.bmp', $sPath & $sFilename & $sExtension, 1) Else _Crop($sImagePath, $sPath & $sFilename & $sExtension, @DesktopWidth, @DesktopHeight) If @error Then FileCopy($sImagePath, $sPath & $sFilename & $sExtension, 1) EndIf Else FileCopy($sImagePath, $sPath & $sFilename & $sExtension, 1) EndIf EndIf EndIf Else Return SetError(1) EndIf EndFunc ;==>_CreateCustomizerThemeAddPic Func _Gallery() _GDIPlus_Startup() Local $ImageGalleryLv, $GalleryLv, $iStylesEx $iStylesEx = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES, $LVS_EX_CHECKBOXES) Local $sDrive = "", $sDir = "", $sFilename = "", $sExtension = "" GUISetState(@SW_DISABLE, $hGui) Local $sW = @DesktopWidth - 500 Local $sH = @DesktopHeight - 150 $Gallery = GUICreate($AppTitle & " Galerie Photos", $sW, $sH) GUISetState(@SW_SHOW, $Gallery) WinSetOnTop($Gallery, '', 1) WinSetOnTop($Gallery, '', 0) GUISetState(@SW_DISABLE, $Gallery) $GalleryLv = GUICtrlCreateListView("", 5, 5, $sW - 10, ($sH / 2) - 35, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT)) $HwndGalleryLv = GUICtrlGetHandle($GalleryLv) $GalleryLvPicW = ($sW / 2) - 5 $GalleryLvPicH = ($sH / 2) $GalleryLvPicL = 5 $GalleryLvPicT = ($sH / 2) - 10 $GalleryLvPic = GUICtrlCreatePic('', $GalleryLvPicL, $GalleryLvPicT, $GalleryLvPicW, $GalleryLvPicH) Local $GalleryBtn2 = GUICtrlCreateButton("Ajouter des photos", $GalleryLvPicL + $GalleryLvPicW + 5, $GalleryLvPicT, $GalleryLvPicW - 5, 25) $GalleryCheckCrop = GUICtrlCreateCheckbox("Recadrer automatiquement", $GalleryLvPicL + $GalleryLvPicW + 5, $GalleryLvPicT + 40, $GalleryLvPicW - 5, 25) Local $GalleryBtn1 = GUICtrlCreateButton("Valider", $GalleryLvPicL + $GalleryLvPicW + 5, $GalleryLvPicT + 70, $GalleryLvPicW - 5, 25) _GUICtrlListView_InsertColumn($HwndGalleryLv, 0, "", 200) _GUICtrlListView_InsertColumn($HwndGalleryLv, 1, "Chemin", 2000) _GUICtrlListView_SetExtendedListViewStyle($GalleryLv, $iStylesEx) $ImageGalleryLv = _GUIImageList_Create(80, 80, 5, 3, 0, 0) _GUIImageList_SetImageCount($ImageGalleryLv, 0) _GUICtrlListView_SetImageList($HwndGalleryLv, $ImageGalleryLv, 1) Local $FileList Local $sArray[0] _GUICtrlListView_BeginUpdate($HwndGalleryLv) ;~ $FileList = _FileListToArrayRec(@UserProfileDir & '\Pictures', $sFilter, 1, -1, 0, 2) ;~ For $j = 1 To UBound($FileList) - 1 ;~ _ArrayAdd($sArray, $FileList[$j]) ;~ Next $FileList = _FileListToArrayRec($ThemeSearchPath[0], $sFilter, 1, 1, 0, 2) For $j = 1 To UBound($FileList) - 1 _ArrayAdd($sArray, $FileList[$j]) Next $FileList = _FileListToArrayRec($ThemeSearchPath[1], $sFilter, 1, 1, 0, 2) For $j = 1 To UBound($FileList) - 1 _ArrayAdd($sArray, $FileList[$j]) Next Local $iCount = 0 For $j = 0 To UBound($sArray) - 1 _PathSplit($sArray[$j], $sDrive, $sDir, $sFilename, $sExtension) _GUICtrlListView_AdaptImage($HwndGalleryLv, $ImageGalleryLv, $j, $sArray[$j], 80, ' ') $iCount += 1 _GUICtrlListView_AddSubItem($HwndGalleryLv, $j, $sArray[$j], 1) WinSetTitle($Gallery, '', (UBound($sArray) - 1) - $j & '/' & UBound($sArray) & ' Images restantes, Veuillez patientez') Sleep(10) Next _GUIImageList_SetImageCount($ImageGalleryLv, $iCount) _GUICtrlListView_EndUpdate($HwndGalleryLv) GUISetState(@SW_ENABLE, $Gallery) GUISetState(@SW_RESTORE, $Gallery) GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") Local $sRet = '' Local $index, $nMsg While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GalleryBtn1 Local $sSubItemTxt, $sFiles = '' Local $iIndex, $aselected If _ListView_CountItemChecked($HwndGalleryLv) > 0 Then For $i = 0 To _GUICtrlListView_GetItemCount($HwndGalleryLv) - 1 If _GUICtrlListView_GetItemChecked($HwndGalleryLv, $i) Then $sSubItemTxt = _GUICtrlListView_GetItemText($HwndGalleryLv, $i, 1) If FileExists($sSubItemTxt) Then $sFiles &= $sSubItemTxt & ';' EndIf EndIf Next $sRet = $sFiles If StringRight($sFiles, 1) = ';' Then $sRet = StringTrimRight($sFiles, 1) Else $aselected = _GUICtrlListView_GetSelectedIndices($HwndGalleryLv, True) If $aselected[0] > 0 Then $iIndex = $aselected[1] $sSubItemTxt = _GUICtrlListView_GetItemText($HwndGalleryLv, $iIndex, 1) If FileExists($sSubItemTxt) Then $sRet = $sSubItemTxt EndIf EndIf EndIf ExitLoop Case $GalleryBtn2 Local $sPath $sPath = FileOpenDialog('Choisissez vos images : ', "::{450D8FBA-AD25-11D0-98A8-0800361B1103}", 'Image (' & $sFilter & ')', 1 + 4, '', $Gallery) If Not @error Then $sRet = $sPath If Not FileExists($sPath) And StringInStr($sPath, '|') Then ; if multiple files. Local $aFileToAdd = StringSplit($sPath, '|', 1 + 2) Local $sWorkingDir = $aFileToAdd[0] For $i = 1 To UBound($aFileToAdd) - 1 $aFileToAdd[$i] = $sWorkingDir & '\' & $aFileToAdd[$i] _PathSplit($aFileToAdd[$i], $sDrive, $sDir, $sFilename, $sExtension) $index = _GUICtrlListView_AdaptImage($HwndGalleryLv, $ImageGalleryLv, $iCount, $aFileToAdd[$i], 80, ' ') _GUICtrlListView_SetItemChecked($HwndGalleryLv, $iCount) _GUICtrlListView_AddSubItem($HwndGalleryLv, $index, $aFileToAdd[$i], 1) $iCount += 1 WinSetTitle($Gallery, '', (UBound($aFileToAdd) - 1) - $i & '/' & UBound($aFileToAdd) & ' Images restantes, Veuillez patientez') Sleep(10) Next Else $index = _GUICtrlListView_AdaptImage($HwndGalleryLv, $ImageGalleryLv, $iCount, $sPath, 80, ' ') _GUICtrlListView_SetItemChecked($HwndGalleryLv, $iCount) _GUICtrlListView_AddSubItem($HwndGalleryLv, $index, $sPath, 1) $iCount += 1 EndIf _GUIImageList_SetImageCount($ImageGalleryLv, $iCount) _ListView_ScrollItem($HwndGalleryLv) EndIf Case $GUI_EVENT_CLOSE $sRet = '' ExitLoop EndSwitch WEnd _GDIPlus_Shutdown() If _IsChecked($GalleryCheckCrop) Then $GalleryCheckCrop = 1 GUIDelete($Gallery) GUISetState(@SW_ENABLE, $hGui) GUISetState(@SW_RESTORE, $hGui) Return $sRet EndFunc ;==>_Gallery Func _ListView_GetItemSelected($hWnd) If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) Local $CountItemChecked = 0 For $i = 0 To _GUICtrlListView_GetItemCount($hWnd) - 1 If _GUICtrlListView_GetItemSelected($hWnd, $i) Then $CountItemChecked = $i ExitLoop EndIf Next Return $CountItemChecked EndFunc ;==>_ListView_GetItemSelected Func _ListView_CountItemChecked($hWnd) If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) Local $CountItemChecked = 0 For $i = 0 To _GUICtrlListView_GetItemCount($hWnd) - 1 If _GUICtrlListView_GetItemChecked($hWnd, $i) Then $CountItemChecked += 1 EndIf Next Return $CountItemChecked EndFunc ;==>_ListView_CountItemChecked Func _ListView_ScrollItem($ListView1, $iItemIndex = -1, $fPartialOK = True, $iIncrement = 1) Local $iSuccess1, $iSuccess2 If $iItemIndex = -1 Then $iItemIndex = _GUICtrlListView_GetItemCount($ListView1) - 1 $iSuccess1 = _GUICtrlListView_Scroll($ListView1, 0, $iIncrement) $iSuccess2 = _GUICtrlListView_EnsureVisible($ListView1, $iItemIndex, $fPartialOK) Return $iSuccess1 And $iSuccess2 EndFunc ;==>_ListView_ScrollItem Func _IsChecked($idControlID) Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked Func _Upd($string, $flag = 0) Switch $flag Case 0 ConsoleWrite($string & @LF) Case 1 ConsoleWrite(@TAB & $string & @LF) Case 2 MsgBox(0, 'debug', $string & @LF) Case 3 FileWrite(@ScriptDir & '\WTClog.txt', @YEAR & '/' & @MON & '/' & @MDAY & '-' & @HOUR & ':' & @MIN & ':' & @SEC & @TAB & $string & @CRLF) EndSwitch EndFunc ;==>_Upd Func _InetGet($sUrl, $sOutPath, $Progress = True) Local $hDownload = InetGet($sUrl, $sOutPath, 1, 1) If $Progress Then ProgressOn($AppTitle, 'Telechargement en cour', '', -1, -1, 16) Do Local $totalsize = 0 Local $kbrecu = InetGetInfo($hDownload, 0) If $kbrecu > 0 Then If $totalsize = 0 Then $totalsize = InetGetInfo($hDownload, 1) EndIf Local $pourcentage = Round($kbrecu * 100 / $totalsize) If $Progress Then ProgressSet($pourcentage, $pourcentage & "%") EndIf Sleep(50) Until InetGetInfo($hDownload, 2) If $Progress Then ProgressOff() InetClose($hDownload) EndFunc ;==>_InetGet Func _GetNewFileName($sFilename, $sDir, $iExt_Mod = -1, $sDelim1 = -1, $sDelim2 = -2) If Not FileExists($sDir & "\" & $sFilename) Then Return $sFilename $sDir = StringRegExpReplace($sDir, "\\ *$", "") Local $sName = StringRegExpReplace($sFilename, "\.[^.]*$", "") If $iExt_Mod <> -1 Then $sName = StringRegExpReplace($sFilename, "\.[^.]*(\.[^.]*$|$)", "") Local $sExtn = StringMid($sFilename, StringLen($sName) + 1) Local $iCount = 1, $sRet_FileName = $sFilename While FileExists($sDir & "\" & $sRet_FileName) If $sDelim1 = -1 And $sDelim2 = -2 Then $sRet_FileName = $sName & " (" & $iCount & ")" & $sExtn ElseIf $sDelim1 <> -1 And $sDelim2 <> -2 Then $sRet_FileName = $sName & $sDelim1 & $iCount & $sDelim2 & $sExtn ElseIf $sDelim1 <> -1 And $sDelim2 = -2 Then $sRet_FileName = $sName & $sDelim1 & $iCount & $sExtn EndIf $iCount += 1 WEnd Return $sRet_FileName EndFunc ;==>_GetNewFileName Func _CreateNewFolder($sRootPath = '', $aName = 'Nouveau Dossier') Local $sPath, $sRet_FileName = '', $iCount = 0 Local $sRet[2] If $sRootPath == "" Then Return If StringRight($sRootPath, 1) == "\" Then $sPath = $sRootPath & $aName Else $sPath = $sRootPath & '\' & $aName EndIf If FileExists($sPath) Then While FileExists($sPath & $sRet_FileName) $sRet_FileName = " (" & $iCount & ")" $iCount += 1 WEnd $sPath = $sPath & $sRet_FileName DirCreate($sPath) Else $sRet_FileName = '' DirCreate($sPath) EndIf $sRet[0] = $sPath $sRet[1] = $aName & $sRet_FileName Return $sRet EndFunc ;==>_CreateNewFolder Func _ReadExifData($Img, $sOutFile, $flag = 0) Local $sRet = False Local $sFile = $Img Local $sAngle = '' Local $sDrive = "", $sDir = "", $sFilename = "", $sExtension = "" _PathSplit($Img, $sDrive, $sDir, $sFilename, $sExtension) FileCopy($Img, $DlPath & 'ExifFliped' & $sExtension, 1) $Img = $DlPath & 'ExifFliped' & $sExtension Local $rotate = _ImageGetInfo($Img) Local $file = $DlPath & 'exif.txt' FileDelete($file) FileWrite($file, $rotate) Local $line, $split, $hOpen = FileOpen($file, 0) For $j = 1 To _FileCountLines($file) $line = FileReadLine($file, $j) If StringInStr($line, 'Orientation') Then $split = StringSplit($line, '=') If UBound($split) - 1 >= 2 Then $sAngle = $split[2] EndIf $sRet = True ExitLoop EndIf Next FileClose($hOpen) Switch $flag Case 0 If Not $sRet Then Return False EndIf Switch $sAngle Case '90° right' _ImageRotateFlip(1, $sOutFile, $sFile) Return True Case '90° left' _ImageRotateFlip(3, $sOutFile, $sFile) Return True ;~ Case '180° right' EndSwitch EndSwitch Return False EndFunc ;==>_ReadExifData Func _ImageRotateFlip($sAngle = 1, $sOutFile = $DlPath & 'Theme changeur WpRotate.bmp', $sFile = _Lv2SearchFullPathWp(_GUICtrlListView_GetItemText($ListView2, _ListView_GetItemSelected($ListView2), 0))) _GDIPlus_Startup() Local $hImage = _GDIPlus_ImageLoadFromFile($sFile) Local $imgX = _GDIPlus_ImageGetWidth($hImage) Local $imgY = _GDIPlus_ImageGetHeight($hImage) Local $himage_Clone = _GDIPlus_BitmapCloneArea($hImage, 0, 0, $imgX, $imgY, $GDIP_PXF32ARGB) _GDIPlus_ImageRotateFlip($himage_Clone, $sAngle) _GDIPlus_ImageSaveToFile($himage_Clone, $sOutFile) _GDIPlus_BitmapDispose($himage_Clone) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() EndFunc ;==>_ImageRotateFlip Func _ChangeWallpaperEx($flag = 0, $sImage = _Lv2SearchFullPathWp(_GUICtrlListView_GetItemText($ListView2, _ListView_GetItemSelected($ListView2), 0))) _Upd('_ChangeWallpaperEx', 1) Switch $flag Case 0 _Crop($sImage, $DlPath & 'Theme changeur WpCrop.bmp', @DesktopWidth, @DesktopHeight) If Not @error Then _ChangeWallpaper($DlPath & 'Theme changeur WpCrop.bmp', 5) Else _Convert2bmp($sImage, $DlPath & '\Theme changeur WpConverted.bmp') _ChangeWallpaper($DlPath & '\Theme changeur WpConverted.bmp', 5) EndIf Case 1 _Crop2($sImage, $DlPath & 'Theme changeur WpCrop.bmp', @DesktopWidth, @DesktopHeight) If Not @error Then _ChangeDesktopWallpaper($DlPath & 'Theme changeur WpCrop.bmp', 0) Else _Upd('_Crop2 @error ' & @error, 1) _Convert2bmp($sImage, $DlPath & '\Theme changeur WpConverted.bmp') _ChangeDesktopWallpaper($DlPath & '\Theme changeur WpConverted.bmp', 0) EndIf EndSwitch EndFunc ;==>_ChangeWallpaperEx Func _FileMove($sInFile = $DlPath & 'Theme changeur WpRotate.bmp', $sOutFile = _Lv2SearchFullPathWp(_GUICtrlListView_GetItemText($ListView2, _ListView_GetItemSelected($ListView2), 0))) Return FileMove($sInFile, $sOutFile, 1) EndFunc ;==>_FileMove #Region Import ; by wakillon Func _GUICtrlListView_AdaptImage($hListView, $hImageList, $iIndex, $sFilePath, $sImageSize = 128, $flag = '') If Not FileExists($sFilePath) Then Return SetError(1, 0, 0) Local $sDrive = "", $sDir = "", $sFilename = "", $sExtension = "" _PathSplit($sFilePath, $sDrive, $sDir, $sFilename, $sExtension) Local $hBitmap = _GDIPlus_BitmapCreateFromFile($sFilePath) Local $iNewWidth, $iNewHeight, $hBitmap_Scaled2, $hGraphic, $iRatio Local $iWidth = _GDIPlus_ImageGetWidth($hBitmap) Local $iHeight = _GDIPlus_ImageGetHeight($hBitmap) If $iWidth >= $iHeight Then ; si carré ou si limage est horizontal $iRatio = $iHeight / $iWidth $iNewWidth = $sImageSize $iNewHeight = Int($sImageSize * $iRatio) Else $iRatio = $iWidth / $iHeight $iNewWidth = Int($sImageSize * $iRatio) $iNewHeight = $sImageSize EndIf $hBitmap_Scaled2 = _GDIPlus_BitmapCreateFromScan0Ex($sImageSize, $sImageSize) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap_Scaled2) If $iWidth < $sImageSize And $iHeight < $sImageSize Then _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, ($sImageSize - $iWidth) / 2, ($sImageSize - $iHeight) / 2, $iWidth, $iHeight) Else _GDIPlus_GraphicsDrawImageRectRect($hGraphic, $hBitmap, _ 0, _ 0, _ $iWidth, _ $iHeight, _ ($sImageSize - $iNewWidth) / 2, _ ($sImageSize - $iNewHeight) / 2, _ $iNewWidth, _ $iNewHeight) EndIf Local $hImageBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap_Scaled2) _GDIPlus_ImageResize($hBitmap_Scaled2, $iNewWidth, $iNewHeight) _GUIImageList_Add($hImageList, $hImageBMP) _WinAPI_DeleteObject($hImageBMP) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_BitmapDispose($hBitmap_Scaled2) _GDIPlus_BitmapDispose($hBitmap) If $flag = '' Then Return _GUICtrlListView_AddItem($hListView, $sFilename & $sExtension, $iIndex) Else Return _GUICtrlListView_AddItem($hListView, $flag, $iIndex) EndIf EndFunc ;==>_GUICtrlListView_AdaptImage Func _GDIPlus_BitmapCreateFromScan0Ex($iWidth, $iHeight, $iPixelFormat = $GDIP_PXF32ARGB, $iStride = 0, $pScan0 = 0) Local $aResult = DllCall($__g_hGDIPDll, 'uint', 'GdipCreateBitmapFromScan0', 'int', $iWidth, 'int', $iHeight, 'int', $iStride, 'int', $iPixelFormat, 'ptr', $pScan0, 'handle*', 0) If @error Then Return SetError(@error, @extended, 0) If $aResult[0] Then Return SetError(10, $aResult[0], 0) Return $aResult[6] EndFunc ;==>_GDIPlus_BitmapCreateFromScan0Ex ; by mikell Func _UpdatePreview($wpactuel = _Lv2SearchFullPathWp(_GUICtrlListView_GetItemText($ListView2, _ListView_GetItemSelected($ListView2), 0))) _GDIPlus_Startup() Local $hImage = _GDIPlus_ImageLoadFromFile($wpactuel) Local $hClone If $SelectedWpXo < $SelectedWpWidth Then $hClone = _GDIPlus_BitmapCloneArea($hImage, 0, $SelectedWpTop, $SelectedWpXo, $SelectedWpHeight, $GDIP_PXF24RGB) ElseIf $SelectedWpXo > $SelectedWpWidth Then $hClone = _GDIPlus_BitmapCloneArea($hImage, $SelectedWpLeft, 0, $SelectedWpWidth, $SelectedWpYo, $GDIP_PXF24RGB) EndIf _GDIPlus_ImageSaveToFile($hClone, $DlPath & 'Theme changeur sCrop.jpg') _GDIPlus_ImageDispose($hClone) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() Local $Crop, $sOutFile $sOutFile = $wpactuel $Crop = _CropFill($DlPath & 'Theme changeur sCrop.jpg', $DlPath & 'Theme changeur Miniature.jpg', $sWpic, $sHpic) If Not @error Then $sOutFile = $Crop GUICtrlSetImage($pic, '') GUICtrlSetImage($pic, $sOutFile) EndFunc ;==>_UpdatePreview Func _ActuPreview($wpactuel = _Lv2SearchFullPathWp(_GUICtrlListView_GetItemText($ListView2, _ListView_GetItemSelected($ListView2), 0))) ; _GDIPlus_Startup() Local $hImage = _GDIPlus_ImageLoadFromFile($wpactuel) $SelectedWpXo = _GDIPlus_ImageGetWidth($hImage) ; dimensions de l'image originale $SelectedWpYo = _GDIPlus_ImageGetHeight($hImage) ;~ _GetWindowFormatByRes() ;~ Select ;~ Case $choice = "4'3" ;~ $iHeight = Round($Xo * 3 / 4) ;~ $iWidth = Round($Yo * 4 / 3) ;~ Case $choice = "16'10" $SelectedWpHeight = Round($SelectedWpXo / 1.6) ; dimensions de la nouvelle image $SelectedWpWidth = Round($SelectedWpYo * 1.6) ;~ Case $choice = "16'9" ;~ $iHeight = Round($Xo * 9 / 16) ;~ $iWidth = Round($Yo * 16 / 9) ;~ EndSelect _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() Sleep(100) If FileExists($DlPath & 'Theme changeur sCrop.jpg') Then FileDelete($DlPath & 'Theme changeur sCrop.jpg') Local $Crop, $sOutFile $sOutFile = $wpactuel If $SelectedWpXo = $SelectedWpWidth Then $sWpic = ($sWlv / 2) + 15 $sHpic = ($sHgui / 2) - 12 GUICtrlSetPos($pic, Default, Default, $sWpic, $sHpic) GUICtrlSetState($PicSliderV, $GUI_DISABLE + $GUI_HIDE) GUICtrlSetState($PicSliderH, $GUI_DISABLE + $GUI_HIDE) $Crop = _CropFill($wpactuel, $DlPath & 'Theme changeur Miniature.jpg', $sWpic, $sHpic) If Not @error Then $sOutFile = $Crop GUICtrlSetImage($pic, '') GUICtrlSetImage($pic, $sOutFile) Else $sWpic = ($sWlv / 2) - 15 $sHpic = ($sHgui / 2) - 42 GUICtrlSetPos($pic, Default, Default, $sWpic, $sHpic) If $SelectedWpXo < $SelectedWpWidth Then GUICtrlSetState($PicSliderV, $GUI_ENABLE + $GUI_SHOW) GUICtrlSetData($PicSliderV, 105) $SelectedWpTop = ($SelectedWpYo - $SelectedWpHeight) * 105 / 210 GUICtrlSetState($PicSliderH, $GUI_DISABLE + $GUI_HIDE) _UpdatePreview($wpactuel) ElseIf $SelectedWpXo > $SelectedWpWidth Then GUICtrlSetState($PicSliderH, $GUI_ENABLE + $GUI_SHOW) GUICtrlSetData($PicSliderH, 120) $SelectedWpLeft = ($SelectedWpXo - $SelectedWpWidth) * 120 / 240 GUICtrlSetState($PicSliderV, $GUI_DISABLE + $GUI_HIDE) _UpdatePreview($wpactuel) EndIf EndIf EndFunc ;==>_ActuPreview Func _Crop($sFile, $sOutFile, $iOutWidth, $iOutHeight) If FileExists($sOutFile) Then FileDelete($sOutFile) Local $Error = '' _GDIPlus_Startup() Local $hImage = _GDIPlus_ImageLoadFromFile($sFile) If @error Then $Error = 1 Local $Crop_Xo = _GDIPlus_ImageGetWidth($hImage) If @error Then $Error = 2 Local $Crop_Yo = _GDIPlus_ImageGetHeight($hImage) If @error Then $Error = 3 _GDIPlus_ImageDispose($hImage) Local $Crop_Width, $Crop_Height, $iDiff, $Crop_Top, $hClone, $Crop_Left, $ret $Crop_Height = Round($Crop_Xo * 9 / 16) $Crop_Width = Round($Crop_Yo * 16 / 9) _Upd('_Crop', 1) If $Crop_Xo <> $Crop_Width Then If $Crop_Xo < $Crop_Width Then _Upd('$Crop_Xo < $Crop_Width ', 0) $iDiff = $Crop_Yo - $Crop_Height $Crop_Top = $iDiff * 105 / 210 $hImage = _GDIPlus_ImageLoadFromFile($sFile) If @error Then $Error = 4 $hClone = _GDIPlus_BitmapCloneArea($hImage, 0, $Crop_Top, $Crop_Xo, $Crop_Height, $GDIP_PXF24RGB) If @error Then $Error = 5 $ret = _GDIPlus_ImageSaveToFile($hClone, $sOutFile) If @error Then $Error = 6 _GDIPlus_BitmapDispose($hClone) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() ElseIf $Crop_Xo > $Crop_Width Then _Upd('$Crop_Xo > $Crop_Width ', 0) $iDiff = $Crop_Xo - $Crop_Width $Crop_Left = $iDiff * 120 / 240 $hImage = _GDIPlus_ImageLoadFromFile($sFile) If @error Then $Error = 4 $hClone = _GDIPlus_BitmapCloneArea($hImage, $Crop_Left, 0, $Crop_Width, $Crop_Yo, $GDIP_PXF24RGB) If @error Then $Error = 5 $ret = _GDIPlus_ImageSaveToFile($hClone, $sOutFile) If @error Then $Error = 6 _GDIPlus_BitmapDispose($hClone) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() Else _CropFill($sFile, $sOutFile, $iOutWidth, $iOutHeight) If @error Then Return SetError(@error, 0, '__ScaleImage') EndIf Else _CropFill($sFile, $sOutFile, $iOutWidth, $iOutHeight) If @error Then Return SetError(@error, 0, '__ScaleImage') EndIf Switch $Error Case '' Return $sOutFile Case Else Return SetError($Error, 0, '_ScaleImage') EndSwitch EndFunc ;==>_Crop ;coded by UEZ Func _CropFill($sInFile, $sOutFile, $iOutWidth, $iOutHeight, $iCrop = 1) Local $hInHandle, $iInWidth, $iInHeight, $iRatio, $hOutHandle, $hGraphic, $iInX = 0, $iInY = 0 Local $Error = '' _GDIPlus_Startup() $hInHandle = _GDIPlus_ImageLoadFromFile($sInFile) If @error Then $Error = 1 $iInWidth = _GDIPlus_ImageGetWidth($hInHandle) If @error Then $Error = 2 $iInHeight = _GDIPlus_ImageGetHeight($hInHandle) If @error Then $Error = 3 If $iCrop = 1 Then If $iOutWidth / $iInWidth > $iOutHeight / $iInHeight Then $iRatio = $iOutWidth / $iInWidth Else $iRatio = $iOutHeight / $iInHeight EndIf $iInX = Int(($iInWidth - $iOutWidth / $iRatio) / 2) $iInY = Int(($iInHeight - $iOutHeight / $iRatio) / 4) $iInWidth = Int($iOutWidth / $iRatio) $iInHeight = Int($iOutHeight / $iRatio) Else If $iOutWidth / $iInWidth < $iOutHeight / $iInHeight Then $iRatio = $iOutWidth / $iInWidth Else $iRatio = $iOutHeight / $iInHeight EndIf If $iRatio > 1 Then $iRatio = 1 EndIf $iOutWidth = Int($iInWidth * $iRatio) $iOutHeight = Int($iInHeight * $iRatio) EndIf $hOutHandle = _GDIPlus_BitmapCreateFromScan0($iOutWidth, $iOutHeight) If @error Then $Error = 4 $hGraphic = _GDIPlus_ImageGetGraphicsContext($hOutHandle) If @error Then $Error = 5 _GDIPlus_GraphicsDrawImageRectRect($hGraphic, $hInHandle, $iInX, $iInY, $iInWidth, $iInHeight, 0, 0, $iOutWidth, $iOutHeight) If @error Then $Error = 6 If $iOutWidth <> $sWpic Then _Upd('_CropFill', 0) _GDIPlus_ImageSaveToFile($hOutHandle, $sOutFile) If @error Then $Error = 7 _GDIPlus_ImageDispose($hInHandle) _GDIPlus_ImageDispose($hOutHandle) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() Switch $Error Case '' Return $sOutFile Case Else Return SetError($Error, 0, '_CropFill') EndSwitch EndFunc ;==>_CropFill Func _Crop2($sFile, $sOutFile, $iNewWidth, $iNewHeight) If Not FileExists($sFile) Then Return SetError(1, 0, 0) _GDIPlus_Startup() Local $Error = '' Local $hImage = _GDIPlus_ImageLoadFromFile($sFile) If @error Then _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() Return SetError(2, 0, 0) EndIf Local $iWidth = _GDIPlus_ImageGetWidth($hImage) If @error Then $Error = 3 Local $iHeight = _GDIPlus_ImageGetHeight($hImage) If @error Then $Error = 4 Local $iW, $iH, $f, $fRatio If $iWidth > $iHeight Then $f = $iWidth / $iNewWidth Else $f = $iHeight / $iNewHeight EndIf $iW = Int($iWidth / $f) $iH = Int($iHeight / $f) If $iW > $iNewWidth Then $fRatio = $iNewWidth / $iW $iW = Int($iW * $fRatio) $iH = Int($iH * $fRatio) ElseIf $iH > $iNewHeight Then $fRatio = $iNewHeight / $iH $iW = Int($iW * $fRatio) $iH = Int($iH * $fRatio) EndIf Local $hBitmapResized = _GDIPlus_ImageResize($hImage, $iW, $iH) If @error Then $Error = 5 _Upd('_Crop2', 0) _GDIPlus_ImageSaveToFile($hBitmapResized, $sOutFile) If @error Then $Error = 6 _GDIPlus_ImageDispose($hImage) _GDIPlus_BitmapDispose($hBitmapResized) _GDIPlus_Shutdown() Switch $Error Case '' Return $sOutFile Case Else Return SetError($Error, 0, '_Crop2') EndSwitch EndFunc ;==>_Crop2 ;=============================================================================== ; ; Function Name: _ChangeDesktopWallPaper ; Description: Update WallPaper Settings ;Usage: _ChangeDesktopWallPaper(@WindowsDir & '\' & 'zapotec.bmp',1) ; Parameter(s): $bmp - Full Path to BitMap File (*.bmp) ; [$style] - 0 = Centered, 1 = Tiled, 2 = Stretched ; Requirement(s): None. ; Return Value(s): On Success - Returns 0 ; On Failure - -1 ; Author(s): FlyingBoz ;Thanks: Larry - DllCall Example - Tested and Working under XPHome and W2K Pro ; Excalibur - Reawakening my interest in Getting This done. ; ;=============================================================================== Func _ChangeDesktopWallpaper($bmp, $Style = 0) If Not FileExists($bmp) Then Return -1 ;The $SPI* values could be defined elsewhere via #include - if you conflict, ; remove these, or add if Not IsDeclared "SPI_SETDESKWALLPAPER" Logic Local $SPI_SETDESKWALLPAPER = 20 Local $SPIF_UPDATEINIFILE = 1 Local $SPIF_SENDCHANGE = 2 Local $REG_DESKTOP = "HKEY_CURRENT_USER\Control Panel\Desktop" If $Style = 1 Then RegWrite($REG_DESKTOP, "TileWallPaper", "REG_SZ", 1) RegWrite($REG_DESKTOP, "WallpaperStyle", "REG_SZ", 0) Else RegWrite($REG_DESKTOP, "TileWallPaper", "REG_SZ", 0) RegWrite($REG_DESKTOP, "WallpaperStyle", "REG_SZ", $Style) EndIf DllCall("user32.dll", "int", "SystemParametersInfo", _ "int", $SPI_SETDESKWALLPAPER, _ "int", 0, _ "str", $bmp, _ "int", BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDCHANGE)) Return 0 EndFunc ;==>_ChangeDesktopWallpaper ; #FUNCTION# ==================================================================================================================== ; Name...........: _ChangeWallpaper ; Description ...: Change Windows Wallpaper ; Syntax.........: _ChangeWallpaper($sImage, [$iStyle]) ; Parameters ....: $sImage - The path of the .bmp file ; $$iStyle - The numeric value of desidered style ; 0 Tiled ; 1 Centered ; 2 Stretched ; 3 Fit (Windows 7 and later) ; 4 Fill (Windows 7 and later) ; 5 Screen Width ; $bResize - Automatically resize th image if has a higher resolution than screen ; Return values .: On Success - Return the new file name. ; On Failure - ; @error = 1 The image doesn't exist ; @error = 2 The image is not a .bmp file ; @error = 3 Invalid style ; @error = 4 Style not supported by OS ; @error = 5 Unable to change the wallpaper ; Author ........: Nessie ; =============================================================================================================================== Func _ChangeWallpaper($sImage, $iStyle = 0, $bResize = True) If Not FileExists($sImage) Then Return SetError(1, 0, "") ;~ If _IsChecked($GuiWm_CheckAuto) And $wmPreview == False Then Return -1 ;~ $CurrentWP = $sImage Local $sImageExt = StringLower(StringRight($sImage, 4)) Local $aImageSize Local $fWinVer = _GetWinVersion() If $sImageExt <> '.bmp' And $fWinVer < 6.0 Then Return SetError(2, 0, "") Else If $fWinVer >= 6.0 And $sImageExt <> '.bmp' And $sImageExt <> '.jpg' Then Return SetError(2, 0, "") EndIf EndIf If $iStyle < 0 Or $iStyle > 5 Then Return SetError(3, 0, "") If $fWinVer < 6.0 Then ; More info http://msdn.microsoft.com/en-us/library/windows/desktop/ms724832%28v=vs.85%29.aspx If $iStyle > 2 Then Return SetError(4, 0, "") EndIf Local $sWallpaperKey = "HKEY_CURRENT_USER\Control Panel\Desktop" Local $iTileWallPaper, $iWallpaperStyle If $bResize And $fWinVer >= 6.0 Then $aImageSize = _ImageGetSize($sImage) If @error Then Return SetError(5, 0, "") If $aImageSize[0] > @DesktopWidth Or $aImageSize[1] > @DesktopHeight Then $iStyle = 5 ;Force style n°5 EndIf EndIf Switch $iStyle Case 0 $iTileWallPaper = 1 $iWallpaperStyle = 0 Case 1 $iTileWallPaper = 0 $iWallpaperStyle = 0 Case 2 $iTileWallPaper = 0 $iWallpaperStyle = 2 Case 3 $iTileWallPaper = 0 $iWallpaperStyle = 6 Case 4 $iTileWallPaper = 0 $iWallpaperStyle = 10 Case 5 $iTileWallPaper = 0 $iWallpaperStyle = 4 EndSwitch RegWrite($sWallpaperKey, "TileWallPaper", "REG_SZ", $iTileWallPaper) If @error Then Return SetError(5, 0, "") RegWrite($sWallpaperKey, "WallpaperStyle", "REG_SZ", $iWallpaperStyle) If @error Then Return SetError(5, 0, "") ;Thanks to guinness for his advice ; Idea from here: http://www.autoitscript.com/forum/topic/19370-autoit-wrappers/page__st__280#entry652536 ; $SPI_SETDESKWALLPAPER, $SPIF_UPDATEINIFILE and $SPIF_SENDCHANGE can be found on APIConstants.au3 included on WinAPIEx by Yashied ;Return _WinAPI_SystemParametersInfo($SPI_SETDESKWALLPAPER, 0, DllStructGetPtr($tBuffer), BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDCHANGE)) Local $tBuffer = DllStructCreate('wchar Text[' & StringLen($sImage) + 1 & ']') DllStructSetData($tBuffer, 'Text', $sImage) Return _WinAPI_SystemParametersInfo(0x0014, 0, DllStructGetPtr($tBuffer), BitOR(0x0001, 0x0002)) If @error Then Return SetError(5, 0, "") Return True EndFunc ;==>_ChangeWallpaper ; #FUNCTION# ==================================================================================================================== ; Name ..........: _ImageGetSize ; Description ...: Retive the size of an image (Width & Height) ; Syntax ........: _ImageGetSize($sImage) ; Parameters ....: $sImage - The path of the image. ; Return values .: Return an array with the image size ; On Success - ; $array[0] = Image Width ; $array[1] = Image Height ; On Failure - ; @error = 1 The file doesn't exist ; @error = 2 Unable to load the image ; @error = 3 Unable to get the image Width ; @error = 4 Unable to get the image Height ; Author ........: Nessie ; Example .......: _ImageGetSize("C:\Nessie.jpg") ; =============================================================================================================================== Func _ImageGetSize($sImage) Local $iWidth, $iHeight, $aResult[2] If Not FileExists($sImage) Then Return SetError(1, 0, "") _GDIPlus_Startup() Local $hImage = _GDIPlus_ImageLoadFromFile($sImage) If @error Then _GDIPlus_Shutdown() Return SetError(2, 0, "") EndIf $iWidth = _GDIPlus_ImageGetWidth($hImage) If @error Then _GDIPlus_Shutdown() Return SetError(3, 0, "") EndIf $iHeight = _GDIPlus_ImageGetHeight($hImage) If @error Then _GDIPlus_Shutdown() Return SetError(4, 0, "") EndIf _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() $aResult[0] = $iWidth $aResult[1] = $iHeight Return $aResult EndFunc ;==>_ImageGetSize Func _Convert2bmp($oldimg, $bmpimg) _GDIPlus_Startup() Local $hImage2 = _GDIPlus_ImageLoadFromFile($oldimg) Local $CLSID = _GDIPlus_EncodersGetCLSID('BMP') _GDIPlus_ImageSaveToFileEx($hImage2, $bmpimg, $CLSID) _GDIPlus_ImageDispose($hImage2) _GDIPlus_Shutdown() EndFunc ;==>_Convert2bmp Func _GetWinVersion() Local $sRet = RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\', 'CurrentVersion') If @error Then Return SetError(0, 0, "") Return $sRet EndFunc ;==>_GetWinVersion #EndRegion Import _MainLoop()