L'idée : prendre n'importe quelle image quelles que soient ses dimensions et la retailler de manière interactive à un format pré-défini pour pouvoir l'utiliser en fond d'écran "propre"
Pas sûr que ça marche encore sur tous les PC mais le script peut servir d'exemple...
► Afficher le texte
Code : Tout sélectionner
#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#include <GuiSlider.au3>
#Include <GuiComboBox.au3>
Global Const $WS_BORDER = 0x00800000
Global Const $WS_POPUP = 0x80000000
Global Const $WS_EX_TOPMOST = 0x00000008
Global Const $WS_EX_DLGMODALFRAME = 0x00000001
Global $wpactuel, $szDrive, $szDir, $szFName, $szExt
Global $Xo, $Yo, $iWidth, $iHeight, $iTop, $iLeft
Global $choice
Global $MyIni = @ScriptDir & "\WPresizer.ini"
Global $alert = 0
$wpactuel = RegRead("HKCU\Control Panel\Desktop","Wallpaper")
If Not FileExists($wpactuel) Then $wpactuel = RegRead("HKCU\Control Panel\Desktop","WallpaperOrig")
RegWrite('HKCU\Control Panel\Desktop','Wallpaper','reg_sz',$wpactuel)
$wpprec = RegRead("HKCU\Control Panel\Desktop","SavedWallpaper")
RegWrite('HKCU\Control Panel\Desktop','WallpaperOrig','reg_sz',$wpprec)
RegWrite('HKCU\Control Panel\Desktop','SavedWallpaper','reg_sz',$wpactuel)
If Not FileExists($MyIni) Then
IniWrite ($MyIni, "images", "image1", "")
RegWrite('HKCU\Control Panel\Desktop','WallpaperOrig','reg_sz',$wpactuel)
RegWrite('HKCU\Control Panel\Desktop','SavedWallpaper','reg_sz',$wpactuel)
EndIf
$Main = GUICreate("Wallpaper Recadror ", 700, 340, -1, 150)
GUICtrlCreateGroup("", 640, 10, 40, 26)
$manual = GUICtrlCreateLabel("Info", 641, 17, 37, 16, $SS_CENTER + $SS_NOTIFY)
GUICtrlCreateGroup("", 20, 10, 615, 26)
$checklb = GUICtrlCreateLabel("Redimensionner l'image pour un affichage : ", 120, 17, 210, 16, $SS_CENTER)
$check43 = GUICtrlCreateRadio (" 4 : 3", 345, 17, 60, 16)
$check1610 = GUICtrlCreateRadio (" 16 : 10", 415, 17, 60, 16)
$check169 = GUICtrlCreateRadio (" 16 : 9", 485, 17, 60, 16)
$ReInit = GUICtrlCreateButton("Je veux récupérer mon ancien fond d'écran !", 395, 240, 285, 22)
$bklabel = GUICtrlCreateLabel("", 18, 43, 20, 20, $SS_SUNKEN)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetState (-1 , $GUI_HIDE)
$Preview = GUICtrlCreatePic("", 20, 45, 20, 20)
GUICtrlSetState(-1,$GUI_ONTOP)
GUICtrlSetState ($Preview , $GUI_HIDE)
GUISetState(@SW_SHOW)
While 1
$msgd = GUIGetMsg()
Select
Case $msgd = $manual
_info()
Case $msgd = $GUI_EVENT_CLOSE
Exit
Case $msgd = $ReInit
_ReInit()
Case $msgd = $check43
$choice = "4'3"
GUICtrlSetState ($check1610, $GUI_DISABLE + $GUI_HIDE)
GUICtrlSetState ($check169, $GUI_DISABLE + $GUI_HIDE)
GUICtrlSetPos ($bklabel, 35, 45, 286, 216)
GUICtrlSetState ($bklabel , $GUI_SHOW)
GUICtrlSetPos ($Preview, 38, 48, 280, 210)
ExitLoop
Case $msgd = $check1610
$choice = "16'10"
GUICtrlSetState ($check43, $GUI_DISABLE + $GUI_HIDE)
GUICtrlSetState ($check169, $GUI_DISABLE + $GUI_HIDE)
GUICtrlSetPos ($bklabel, 17, 44, 342, 216)
GUICtrlSetState ($bklabel , $GUI_SHOW)
GUICtrlSetPos ($Preview, 20, 47, 336, 210)
ExitLoop
Case $msgd = $check169
$choice = "16'9"
GUICtrlSetState ($check43, $GUI_DISABLE + $GUI_HIDE)
GUICtrlSetState ($check1610, $GUI_DISABLE + $GUI_HIDE)
GUICtrlSetPos ($bklabel, 17, 54, 342, 195)
GUICtrlSetState ($bklabel , $GUI_SHOW)
GUICtrlSetPos ($Preview, 20, 57, 336, 189)
ExitLoop
EndSelect
WEnd
GUICtrlSetState ($Preview , $GUI_SHOW)
GUICtrlSetTip(-1, "wpactuel")
GUICtrlCreateGroup("", 395, 45, 285, 25)
$Input = GUICtrlCreateLabel("", 415, 52, 245, 16, $SS_CENTER)
$constat = GUICtrlCreateLabel("", 405, 80, 275, 20, $SS_CENTER)
$constat2 = GUICtrlCreateLabel("", 405, 95, 275, 20, $SS_CENTER)
$constat3 = GUICtrlCreateLabel("", 405, 120, 275, 20, $SS_CENTER)
$Reset = GUICtrlCreateButton("Revoir l'image de départ", 395, 175, 140, 25)
$try = GUICtrlCreateButton("Essayer en fond d'écran", 540, 175, 140, 25)
;$untry = GUICtrlCreateButton("Annuler", 610, 175, 70, 25)
$Save = GUICtrlCreateButton("Enregistrer cette image", 395, 210, 140, 25)
$Install = GUICtrlCreateButton("Installer en fond d'écran", 540, 210, 140, 25)
;$ReInit = GUICtrlCreateButton("Je veux récupérer mon ancien fond d'écran !", 395, 240, 285, 22)
$combobox = GUICtrlCreateCombo("", 20, 275, 660, 20)
$Browse = GUICtrlCreateButton("Ouvrir (nouvelle image)", 20, 302, 180, 25)
$delitem = GUICtrlCreateButton("Supprimer de la liste", 280, 302, 120, 25)
$savelist = GUICtrlCreateButton("Enregistrer la liste", 405, 302, 110, 25)
$Exit = GUICtrlCreateButton("Quitter", 565, 302, 60, 25)
$About = GUICtrlCreateLabel("?", 690, 325, 15, 15)
$sliderV = GUICtrlCreateSlider(365, 50, 21, 210, $TBS_VERT + $TBS_LEFT + $TBS_NOTICKS + $TBS_FIXEDLENGTH)
_GUICtrlSlider_SetThumbLength($sliderV, 19)
GUICtrlSetLimit ($sliderV, 210, 0)
GUICtrlSetState ($sliderV, $GUI_DISABLE + $GUI_HIDE)
$sliderH = GUICtrlCreateSlider(415, 140, 240, 21, $TBS_NOTICKS + $TBS_TOP + $TBS_FIXEDLENGTH)
_GUICtrlSlider_SetThumbLength($sliderH, 19)
GUICtrlSetLimit ($sliderH, 240, 0)
GUICtrlSetState ($sliderH, $GUI_DISABLE + $GUI_HIDE)
$var = IniReadSection($MyIni, "images") ; recopie la liste du ini vers la combo en vérifiant si les images
$nbitems = $var[0][0] ; existent, et reconstruit le ini
For $i = $nbitems To 1 step -1
If FileExists ($var[$i][1]) Then GUICtrlSetData($combobox, $var[$i][1] & "|", $var[$nbitems][1])
Next ; (affiche à l'envers)
_savelist()
GUISetState(@SW_SHOW)
_add()
_ActuGui()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE OR $msg = $Exit
_savelist()
_untry()
_cleantemp()
Exit
Case $msg = $manual
_info()
Case $msg = $ReInit
_ReInit()
_add()
_ActuGui()
Case $msg = $sliderV
$iDiff = $Yo - $iHeight
$nb = GUICtrlRead($sliderV)
$iTop = $iDiff * $nb / 210
_Verifie()
Case $msg = $sliderH
$iDiff = $Xo - $iWidth
$nb = GUICtrlRead($sliderH)
$iLeft = $iDiff * $nb / 240
_Verifie()
Case $msg = $Reset
GUICtrlSetState ($sliderV, $GUI_DISABLE)
GUICtrlSetState ($sliderH, $GUI_DISABLE)
GUICtrlSetImage ($Preview, $wpactuel)
GUICtrlSetState ($sliderV, $GUI_ENABLE)
GUICtrlSetState ($sliderH, $GUI_ENABLE)
_cleantemp()
Case $msg = $try
WinMinimizeAll()
Sleep(100)
_try()
Sleep(5000)
_untry()
WinMinimizeAllUndo()
Case $msg = $Browse
_Browse()
Case $msg = $Save
_Save()
_savelist()
Case $msg = $Install
_Install()
Case $msg = $combobox
If GUICtrlRead($combobox) <> $wpactuel Then
$wpactuel = GUICtrlRead($combobox)
_ActuGui()
EndIf
Case $msg = $delitem
_delitem()
_savelist()
Case $msg = $savelist
_savelist()
Case $msg = $About
MsgBox(64, "About", "Wallpaper Recadror Multi-Format " & @CRLF & "Made by Michel" & @CRLF & "Le 05-09-2009")
EndSelect
WEnd
;==================================================================
Func _add() ; ajoute item à la combo si n'existe pas déjà
$test = _GUICtrlComboBox_FindString ($combobox, $wpactuel )
If $wpactuel <> "" AND $test = -1 Then _GUICtrlComboBox_InsertString ($combobox, $wpactuel , 0)
_refreshcombo()
_GUICtrlComboBox_SetEditText($combobox, $wpactuel) ; inscrit l'item dans l'edit de la combo
_savelist()
EndFunc ;===>_add()
Func _refreshcombo() ; vide la combo et réécrit la liste
$list = _GUICtrlComboBox_GetListArray ( $combobox)
GUICtrlSetData($combobox, "")
For $i = 1 To $list[0]
GUICtrlSetData($combobox, $list[$i] & "|", $list[1])
Next
GUISetState()
EndFunc ;===>_refreshcombo()
Func _delitem() ; supprime item et réactualise la combo et la gui
$item = GuiCtrlRead($combobox)
$index = _GUICtrlComboBox_FindString($combobox, $item)
_GUICtrlComboBox_DeleteString($combobox, $index)
_refreshcombo()
$wpactuel = GuiCtrlRead($combobox)
_ActuGui()
EndFunc ;===>_delitem()
Func _savelist() ; enregistre la liste de la combo vers le ini
IniDelete ($MyIni, "images")
$combolist = _GUICtrlComboBox_GetListArray ( $combobox)
For $i = ($combolist[0]) to 1 step -1 ; (à l'envers 2ème fois, pour retomber à l'endroit)
IniWrite ($MyIni, "images", "image" & ($combolist[0]-$i+1), $combolist[$i] )
Next
EndFunc ;===>_savelist()
Func _ActuGui() ; actualise input, preview, textes et sliders
_GDIPlus_Startup ()
$hImage = _GDIPlus_ImageLoadFromFile ($wpactuel)
$Xo = _GDIPlus_ImageGetWidth ($hImage) ; dimensions de l'image originale
$Yo = _GDIPlus_ImageGetHeight ($hImage)
Select
Case $choice = "4'3"
$iHeight = Round ($Xo * 3 / 4)
$iWidth = Round ($Yo * 4 / 3)
Case $choice = "16'10"
$iHeight = Round ($Xo / 1.6) ; dimensions de la nouvelle image
$iWidth = Round ($Yo * 1.6)
Case $choice = "16'9"
$iHeight = Round ($Xo * 9 / 16)
$iWidth = Round ($Yo * 16 / 9)
EndSelect
_GDIPlus_ImageDispose ($hImage)
_GDIPlus_ShutDown ()
Sleep (100)
_PathSplit($wpactuel, $szDrive, $szDir, $szFName, $szExt)
GUICtrlSetData ($Input, $szFName & $szExt)
GUICtrlSetImage($Preview, $wpactuel)
GUICtrlSetTip ($Preview, $wpactuel)
If $Xo = $iWidth Then
GUICtrlSetData ($constat, "")
GUICtrlSetData ($constat2, "Cette image a des dimensions correctes,")
GUICtrlSetData ($constat3, "Il n'y a rien modifier !")
GUICtrlSetState ($sliderV, $GUI_DISABLE + $GUI_HIDE)
GUICtrlSetState ($sliderH, $GUI_DISABLE + $GUI_HIDE)
Else
GUICtrlSetData ($constat3, "Déplacer le curseur pour choisir quoi conserver ")
If $Xo < $iWidth Then
GUICtrlSetState ($sliderV, $GUI_ENABLE + $GUI_SHOW)
GUICtrlSetData ($sliderV, 105)
GUICtrlSetState ($sliderH, $GUI_DISABLE + $GUI_HIDE)
GUICtrlSetData ($constat, "Il faut redimensionner cette image, elle est trop haute !")
GUICtrlSetData ($constat2, "De l'image va être perdue en haut et/ou en bas ...")
ElseIf $Xo > $iWidth Then
GUICtrlSetState ($sliderH, $GUI_ENABLE + $GUI_SHOW)
GUICtrlSetData ($sliderH, 120)
GUICtrlSetState ($sliderV, $GUI_DISABLE + $GUI_HIDE)
GUICtrlSetData ($constat, "Il faut redimensionner cette image, elle est trop large !")
GUICtrlSetData ($constat2, "De l'image va être perdue à gauche et/ou à droite ...")
EndIf
EndIf
EndFunc ;===>_ActuGui()
Func _Browse()
_cleantemp()
$wpopen = FileOpenDialog("Choose a picture ...",$szDrive & $szDir,"Image JPEG, Bitmap (*.jpg;*.jpeg;*.bmp)|Image TIFF (*.tif;*.tiff)|All Files (*.*)", 1)
Select
Case @Error
Sleep (100)
Case $szExt = ".bmp" OR $szExt = ".jpg" OR $szExt = ".jpeg" OR $szExt = ".tif" OR $szExt = ".tiff"
$wpactuel = $wpopen
_add()
_ActuGui()
GUISetState(@SW_SHOW, $Main)
Case Else
MsgBox(48,"", " Pas valable, ça : " & $szFName & $szExt)
EndSelect
EndFunc ;===>_Browse()
Func _Verifie()
$verifimg = @TempDir & "\recadrage" & $szExt
_GDIPlus_Startup ()
$hImage = _GDIPlus_ImageLoadFromFile ($wpactuel)
If $Xo < $iWidth Then
$hClone = _GDIPlus_BitmapCloneArea ($hImage, 0, $iTop, $Xo, $iHeight, $GDIP_PXF24RGB)
ElseIf $Xo > $iWidth Then
$hClone = _GDIPlus_BitmapCloneArea ($hImage, $iLeft, 0, $iWidth, $Yo, $GDIP_PXF24RGB)
EndIf
_GDIPlus_ImageSaveToFile($hClone, $verifimg)
_GDIPlus_ImageDispose ($hClone)
_GDIPlus_ImageDispose ($hImage)
_GDIPlus_ShutDown ()
GUICtrlSetImage($Preview, $verifimg)
EndFunc ;===> _Verifie()
Func _Save()
$saveWP = @TempDir & "\recadrage" & $szExt
$ns = ""
If NOT FileExists($saveWP) Then
MsgBox(64,"","L'image existe dèjà ")
Else
If StringInStr ($szFName, $choice) <> 0 Then
$savepath = FileSaveDialog( "Enregistrer sous...", @ScriptDir, "Image (*.jpg;*.jpeg;*.bmp;*.tif;*.tiff)", 2, $szFName & $ns & $szExt)
Else
$savepath = FileSaveDialog( "Enregistrer sous...", @ScriptDir, "Image (*.jpg;*.jpeg;*.bmp;*.tif;*.tiff)", 2, $szFName & " (" & $choice & ")" & $ns & $szExt)
EndIf
If NOT @Error Then
_Option($saveWP, $savepath, $ns)
Else
MsgBox(64,"","Rien à sauvegarder ")
EndIf
_cleantemp()
EndIf
EndFunc ;===> _Save()
Func _Install()
_try()
If $alert = 0 Then
$newWP = @TempDir & "\(essai).bmp"
$ni = ""
If StringInStr ($szFName, $choice) <> 0 Then
$installedwp = @ScriptDir & "\" & $szFName & $ni & ".bmp"
Else
$installedwp = @ScriptDir & "\" & $szFName & " (" & $choice & ")" & $ni & ".bmp"
EndIf
_Option($newWP, $installedwp, $ni)
RegWrite('HKCU\Control Panel\Desktop','Wallpaper','reg_sz',$installedwp)
EndIf
_cleantemp()
$alert = 0
EndFunc ;===>_Install()
Func _Option($source, $dest, $nbr)
If NOT FileExists($dest) Then
If $alert = 0 Then
FileCopy ($source, $dest)
MsgBox(64,"OK","Image enregistrée ")
EndIf
Else
If StringInStr ($szFName, $choice) = 0 Then
While 1
If FileExists($dest) Then
_PathSplit($dest, $szDrive, $szDir, $szFName, $szExt)
$def = StringSplit ($szFName, ")")
$nbr = $def[2] + 1
$dest = $szDrive & $szDir & $def[1] & ")" & $nbr & $szExt
Else
ExitLoop
EndIf
Wend
$MsgBoxA = MsgBox(52,"","Cette image est déjà enregistrée " & @CRLF & @CRLF & " Remplacer ?")
Select
Case $MsgBoxA = 6 ;Yes
$dest = $szDrive & $szDir & $def[1] & ")" & $def[2] & $szExt
FileCopy ($source, $dest, 1)
MsgBox(64,"OK","Image remplacée ")
Case $MsgBoxA = 7 ;No
$dest = $szDrive & $szDir & $def[1] & ")" & $nbr & $szExt
FileCopy ($source, $dest)
MsgBox(64,"OK","Nouvelle image enregistrée ")
EndSelect
EndIf
EndIf
If $alert = 0 Then
$wpactuel = $dest
_add()
_ActuGui()
EndIf
EndFunc ;===>_Option()
Func _try()
$tempWP = @TempDir & "\recadrage" & $szExt
$newWP = @TempDir & "\(essai).bmp"
If FileExists($tempWP) Then
_convert2bmp($tempWP, $newWP)
DllCall("User32.dll","int","SystemParametersInfo","int",20,"int",0,"str",$newWP,"int",0)
Else
$tempWP = GUICtrlRead($combobox)
If $Xo = $iWidth Then
$alert = 0
_convert2bmp($tempWP, $newWP)
DllCall("User32.dll","int","SystemParametersInfo","int",20,"int",0,"str",$newWP,"int",0)
Else
$alert = 1
$MsgBoxA = MsgBox(52,"","Attention, cette image n'a pas été traitée " & @CRLF & @CRLF & " Continuer ?")
Select
Case $MsgBoxA = 6 ;Yes
_convert2bmp($tempWP, $newWP)
DllCall("User32.dll","int","SystemParametersInfo","int",20,"int",0,"str",$newWP,"int",0)
Case $MsgBoxA = 7 ;No
WinMinimizeAllUndo ( )
EndSelect
EndIf
EndIf
EndFunc ;===>_try()
Func _convert2bmp($oldimg, ByRef $bmpimg)
_GDIPlus_Startup ()
$hImage2 = _GDIPlus_ImageLoadFromFile ($oldimg)
$CLSID = _GDIPlus_EncodersGetCLSID('BMP')
_GDIPlus_ImageSaveToFileEx ($hImage2, $bmpimg, $CLSID)
_GDIPlus_ImageDispose ($hImage2)
_GDIPlus_ShutDown ()
EndFunc ;===>_convert2bmp
Func _untry()
If FileExists(@TempDir & "\(essai).bmp") Then
$wpretour = RegRead("HKCU\Control Panel\Desktop","Wallpaper")
DllCall("User32.dll","int","SystemParametersInfo","int",20,"int",0,"str",$wpretour,"int",0)
EndIf
$alert = 0
EndFunc ;===>_untry()
Func _ReInit()
$orig = RegRead("HKCU\Control Panel\Desktop","WallpaperOrig")
$convwp = @HomeDrive & @HomePath & "\Local Settings\Application Data\Microsoft\Wallpaper1.bmp"
If NOT FileExists($orig) OR $orig = "" Then $orig = $convwp
RegWrite('HKCU\Control Panel\Desktop','Wallpaper','reg_sz',$orig)
RegWrite('HKCU\Control Panel\Desktop','SavedWallpaper','reg_sz',$orig)
DllCall("User32.dll","int","SystemParametersInfo","int",20,"int",0,"str",$orig,"int",0)
$wpactuel = $orig
EndFunc ;===> _ReInit()
Func _cleantemp()
FileDelete(@TempDir & "\*.jpg")
FileDelete(@TempDir & "\*.jpeg")
FileDelete(@TempDir & "\*.bmp")
FileDelete(@TempDir & "\*.tif")
FileDelete(@TempDir & "\*.tiff")
EndFunc ;===>_cleantemp()
Func _info()
$infogui = GUICreate("", 450, 377,-1,100, $WS_BORDER + $WS_POPUP, $WS_EX_TOPMOST + $WS_EX_DLGMODALFRAME )
GUICtrlCreateGroup("", 2, 0, 445, 375)
$infotxt = GUICtrlCreateLabel("", 20, 18, 410, 350, $SS_NOTIFY)
$text = "De plus en plus, les nouveaux écrans de PC préfèrent à l'affichage traditionnel de rapport d'image 4:3 les nouveaux affichages larges ""widescreen"" de rapport d'image 16:10 ou 16:9." & @CRLF & @CRLF & "Mais la grande majorité des images disponibles (par internet, par appareil photo numérique, scanner... ) sont au ratio 4:3. Certaines images peuvent aussi avoir été déjà retaillées et avoir des dimensions inhabituelles." & @CRLF & @CRLF & "Redimensionner ces images pour les utiliser en fond d'écran peut alors demander des manipulations fastidieuses avec un logiciel de traitement d'image." & @CRLF & @CRLF & "Wallpaper Recadror permet de prendre n'importe quelle image, quelles que soient ses dimensions ou proportions, pour la réadapter au rapport d'image voulu, sans aucune déformation." & @CRLF & @CRLF & "Fonctions :" & @CRLF & "- accepte les images de format JPEG (*.jpg, *.jpeg), Bitmap (*.bmp), TIFF (*.tif, *.tiff)" & @CRLF & "- test de l'image en fond d'écran (pendant 5 secondes)" & @CRLF & "- sauvegarde simple d'une image recadrée, au format original" & @CRLF & "- sauvegarde automatique au format Bitmap si installation en fond d'écran" & @CRLF & "- gestionnaire d'images par liste déroulante, mis à jour automatiquement en cas d'ajout d'une référence, de suppression d'une référence, ou d'absence d'une image référencée" & @CRLF & "- récupération de l'ancien fond d'écran, même après une précédente fermeture du programme" & @CRLF & "- réalisé sous Windows XP sp3"
GUICtrlSetData($infotxt, $text)
GUISetState()
While 1
$msgok = GUIGetMsg()
If $msgok = $infotxt Then ExitLoop
Wend
GUIDelete($infogui)
EndFunc ;===>_info()
Func _PathSplit($szPath, ByRef $szDrive, ByRef $szDir, ByRef $szFName, ByRef $szExt)
Local $drive = ""
Local $dir = ""
Local $fname = ""
Local $ext = ""
Local $pos
Local $array[5]
$array[0] = $szPath
If StringMid($szPath, 2, 1) = ":" Then
$drive = StringLeft($szPath, 2)
$szPath = StringTrimLeft($szPath, 2)
ElseIf StringLeft($szPath, 2) = "\\" Then
$szPath = StringTrimLeft($szPath, 2)
$pos = StringInStr($szPath, "\")
If $pos = 0 Then $pos = StringInStr($szPath, "/")
If $pos = 0 Then
$drive = "\\" & $szPath
$szPath = ""
Else
$drive = "\\" & StringLeft($szPath, $pos - 1)
$szPath = StringTrimLeft($szPath, $pos - 1)
EndIf
EndIf
Local $nPosForward = StringInStr($szPath, "/", 0, -1)
Local $nPosBackward = StringInStr($szPath, "\", 0, -1)
If $nPosForward >= $nPosBackward Then
$pos = $nPosForward
Else
$pos = $nPosBackward
EndIf
$dir = StringLeft($szPath, $pos)
$fname = StringRight($szPath, StringLen($szPath) - $pos)
If StringLen($dir) = 0 Then $fname = $szPath
$pos = StringInStr($fname, ".", 0, -1)
If $pos Then
$ext = StringRight($fname, StringLen($fname) - ($pos - 1))
$fname = StringLeft($fname, $pos - 1)
EndIf
$szDrive = $drive
$szDir = $dir
$szFName = $fname
$szExt = $ext
$array[1] = $drive
$array[2] = $dir
$array[3] = $fname
$array[4] = $ext
Return $array
EndFunc ;==>_PathSplit
Func _WinAPI_Check($sFunction, $fError, $vError, $fTranslate = False)
If $fError Then
If $fTranslate Then $vError = _WinAPI_GetLastErrorMessage()
_WinAPI_ShowError($sFunction & ": " & $vError)
EndIf
EndFunc ;==>_WinAPI_Check