Code : Tout sélectionner
#include <Array.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
Global $Form1 = GUICreate("Form1", 615, 215, 192, 124)
Global $Edit1 = GUICtrlCreateEdit("", 32, 16, 545, 121)
Global $Button1 = GUICtrlCreateButton("Button1", 136, 160, 321, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$var = GUICtrlRead($Edit1)
$sList = ""
$aKeys = StringRegExp($var, "\N+", 3)
For $i = 0 To UBound($aKeys) - 1
$sList &= _RegSearch($aKeys[$i], "*", 2, False) & @LF
Next
$aInstallDirs = StringRegExp("-" & @CRLF & $sList, "\N+", 3)
$aInstallDirs[0] = UBound($aInstallDirs) - 1
$aInstallDirData = _RegGetDataArray($aInstallDirs)
_ArrayDisplay($aInstallDirData)
EndSwitch
WEnd
Func _RegGetDataArray($aVals)
Local $iDelim, $aRET[$aVals[0] + 1][3] = [[$aVals[0], "Nom de la valeur", "Données de la valeur"]]
For $i = 1 To $aVals[0]
$iDelim = StringInStr($aVals[$i], "\", 0, -1)
$aRET[$i][0] = StringLeft($aVals[$i], $iDelim - 1)
$aRET[$i][1] = StringMid($aVals[$i], $iDelim + 1)
$aRET[$i][2] = RegRead($aRET[$i][0], $aRET[$i][1])
Next
Return $aRET
EndFunc
Func _RegSearch($sStartKey, $sSearchVal, $iType = 0x07, $fArray = False)
Local $v, $sVal, $k, $sKey, $sFound = "", $sFoundSub = "", $avFound[1] = [0]
If StringRight($sStartKey, 1) = "\" Then $sStartKey = StringTrimRight($sStartKey, 1)
If Not BitAND($iType, 0x07) Then Return SetError(1, 0, 0); No returns selected
Local $fKeys = BitAND($iType, 0x1), $fValue = BitAND($iType, 0x2), $fData = BitAND($iType, 0x4), $fRegExp = BitAND($iType, 0x8)
If (Not $fRegExp) And ($sSearchVal == "*") Then
$iType += 0x8
$fRegExp = 0x8
$sSearchVal = "."
EndIf
If ($fValue Or $fData) Then
$v = 1
While 1
$sVal = RegEnumVal($sStartKey, $v)
If @error = 0 Then
If $fValue Then
If $fRegExp Then
If StringRegExp($sVal, $sSearchVal, 0) Then $sFound &= $sStartKey & "\" & $sVal & @LF
Else
If StringInStr($sVal, $sSearchVal) Then $sFound &= $sStartKey & "\" & $sVal & @LF
EndIf
EndIf
If $fData Then
$readval = RegRead($sStartKey, $sVal)
If $fRegExp Then
If StringRegExp($readval, $sSearchVal, 0) Then $sFound &= $sStartKey & "\" & $sVal & " = " & $readval & @LF
Else
If StringInStr($readval, $sSearchVal) Then $sFound &= $sStartKey & "\" & $sVal & " = " & $readval & @LF
EndIf
EndIf
$v += 1
Else
ExitLoop
EndIf
WEnd
EndIf
$k = 1
While 1
$sKey = RegEnumKey($sStartKey, $k)
If @error = 0 Then
If $fKeys Then
If $fRegExp Then
If StringRegExp($sKey, $sSearchVal, 0) Then $sFound &= $sStartKey & "\" & $sKey & "\" & @LF
Else
If StringInStr($sKey, $sSearchVal) Then $sFound &= $sStartKey & "\" & $sKey & "\" & @LF
EndIf
EndIf
$sFoundSub = _RegSearch($sStartKey & "\" & $sKey, $sSearchVal, $iType, False)
If $sFoundSub <> "" Then $sFound &= $sFoundSub & @LF
Else
ExitLoop
EndIf
$k += 1
WEnd
If StringRight($sFound, 1) = @LF Then $sFound = StringTrimRight($sFound, 1)
If $fArray Then
If StringStripWS($sFound, 8) <> "" Then $avFound = StringSplit($sFound, @LF)
Return $avFound
Else
Return $sFound
EndIf
EndFunc