Sign in to follow this  
Followers 0
Celtic88

heelp ;.( treeview

7 posts in this topic

#1 ·  Posted (edited)

I do not know how to describe the problem, but when I click on a "TreeViewItem "Why the "TreeViewItem "disappear

loook

http://youtu.be/w1xQ85O_W5k

Opt("GUIOnEventMode", 1)
Local $64
If @ProcessorArch <> "X86" Then $64 = 64
Local $arr[6] = [5, "HKEY_CLASSES_ROOT" & $64, "HKEY_CURRENT_USER" & $64, "HKEY_LOCAL_MACHINE" & $64, _
        "HKEY_USERS" & $64, "HKEY_CURRENT_CONFIG" & $64]
Global $LISTREG, $TreeREG[7][2], $lastreg[1][2], $treeview, $ListView1, $Combo1
$lastreg[0][0] = 1
$TreeREG[0][0] = 6
GUICreate("My GUI with treeview", 680, 482)
GUISetOnEvent(-3, "__Exit")
$treeview = GUICtrlCreateTreeView(6, 60, 174, 414)
For $io = 1 To $arr[0]
    $TreeREG[$io][1] = $arr[$io]
    $TreeREG[$io][0] = GUICtrlCreateTreeViewItem($arr[$io], $treeview)
    GUICtrlSetOnEvent(-1, "Goreg")
Next
$ListView1 = GUICtrlCreateListView("name|type|value", 192, 60, 482, 414)
$Combo1 = GUICtrlCreateCombo("", 8, 22, 593, 25)
GUICtrlCreateButton("GO", 608, 20, 67, 25)
GUICtrlSetOnEvent(-1, "GO")
GUISetState()

While 1
    Sleep(999)
WEnd

Func __Exit()
    Exit
EndFunc   ;==>__Exit
Func GO()
    Local $idcrlr, $getallreg, $bb, $p, $id
    $idcrlr = GUICtrlRead($Combo1)
    GUICtrlSetData($Combo1, $idcrlr)
    If StringRight($idcrlr, 1) <> "\" Then $idcrlr = $idcrlr & "\"
    $p = StringSplit($idcrlr, "\", 1)
    For $zer = 1 To $p[0] - 1
        $id = regone($bb & $p[$zer])
        If $id <> 0 Then
            $getallreg = GetnumVal($bb & $p[$zer])
        Else
            $id = Gettrell($bb & $p[$zer])
            $getallreg = GetnumKey($bb & $p[$zer])
        EndIf
        Setvar($getallreg, $id)
        GUICtrlSetState($id, 1024 + 512 + 256)
        $bb &= $p[$zer] & "\"
    Next
EndFunc   ;==>GO
Func Goreg()
    Local $idcrlr, $Readcrlr, $getallreg, $idd
    $idcrlr = GUICtrlRead($treeview)
    $Readcrlr = Gettreetxt($idcrlr)
    $idd = regone($Readcrlr)
    If $idd <> 0 Then
        $getallreg = GetnumVal($Readcrlr)
    Else
        $getallreg = GetnumKey($Readcrlr)
        GUICtrlSetData($Combo1, $Readcrlr)
    EndIf
    Setvar($getallreg, $idcrlr)
    GUICtrlSetState($idcrlr, 1024 + 512 + 256)
EndFunc   ;==>Goreg
Func Setvar($sreg, $crl)
    Local $mm, $pl = 1, $pppp = 0
    If IsArray($LISTREG) Then DELETEREGITEMS()
    If $sreg[0] <> "" Then
        $mm = StringSplit($sreg[0], "\@/", 1)
        Dim $LISTREG[$mm[0] + 1]
        $LISTREG[0] = $mm[0]
        For $iu = 1 To $mm[0] - 1
            $LISTREG[$iu] = GUICtrlCreateListViewItem($mm[$iu], $ListView1) ;
        Next
    EndIf
    If $sreg[1] <> "" Then
        $mm = StringSplit($sreg[1], "\@/", 1)
        $pl = $TreeREG[0][0]
        ReDim $TreeREG[$mm[0] + $pl][2]
        $TreeREG[0][0] = $mm[0] + $pl - 1
        For $iu = $pl To $TreeREG[0][0] - 1
            $pppp += 1
            $TreeREG[$iu][0] = GUICtrlCreateTreeViewItem($mm[$pppp], $crl)
            GUICtrlSetOnEvent(-1, "Goreg")
            $TreeREG[$iu][1] = Gettreetxt($crl) & "\" & $mm[$pppp]
        Next
    EndIf
EndFunc   ;==>Setvar
Func regone($zreg)
    For $i = 1 To $lastreg[0][0] - 1
        If $lastreg[$i][0] = $zreg Then Return $lastreg[$i][1]
    Next
    ReDim $lastreg[$lastreg[0][0] + 1][2]
    $lastreg[$lastreg[0][0]][0] = $zreg
    $lastreg[$lastreg[0][0]][1] = Gettrell($zreg)
    $lastreg[0][0] = $lastreg[0][0] + 1
    Return 0
EndFunc   ;==>regone
Func Gettreetxt($crlls)
    For $i = 1 To $TreeREG[0][0] - 1
        If $TreeREG[$i][0] = $crlls Then Return $TreeREG[$i][1]
    Next
EndFunc   ;==>Gettreetxt
Func Gettrell($teext)
    For $i = 1 To $TreeREG[0][0] - 1
        If $TreeREG[$i][1] = $teext Then Return $TreeREG[$i][0]
    Next
EndFunc   ;==>Gettrell
Func DELETEREGITEMS()
    For $i = $LISTREG[0] To 0 Step -1
        GUICtrlDelete($LISTREG[$i])
    Next
    $LISTREG = ""
EndFunc   ;==>DELETEREGITEMS
Func GetnumKey($skey)
    Local $i = 0, $rreg[2], $az
    $az = GetnumVal($skey)
    $rreg[0] = $az[0]
    While True
        $i += 1
        Local $var = RegEnumKey($skey, $i)
        If @error <> 0 Then ExitLoop
        $rreg[1] &= $var & "\@/"
    WEnd
    Return $rreg
EndFunc   ;==>GetnumKey
Func GetnumVal($skey)
    Local $z = 0, $zz[2], $var, $readreg, $extended, _
            $type[11] = ["REG_NONE", "REG_SZ", "REG_EXPAND_SZ", "REG_BINARY", "REG_DWORD", "REG_DWORD_BIG_ENDIAN", "REG_LINK", _
            "REG_MULTI_SZ", "REG_RESOURCE_LIST", "REG_FULL_RESOURCE_DESCRIPTOR", "REG_RESOURCE_REQUIREMENTS_LIST"]
    While True
        $z += 1
        Local $var = RegEnumVal($skey, $z)
        If @error <> 0 Then ExitLoop
        $extended = @extended
        If $var = "" Then
            $var = "(Default)"
            $readreg = "(Value not set)"
        Else
            $readreg = RegRead($skey, $var)
        EndIf
        $zz[0] &= $var & "|" & $type[$extended] & "|" & $readreg & "\@/"
    WEnd
    $zz[1] = ""
    Return $zz
EndFunc   ;==>GetnumVal
Edited by Mrbenkali

Share this post


Link to post
Share on other sites



Any help :(  script update no solution !

Share this post


Link to post
Share on other sites

Please wait at least 24 hours before bumping a thread. This is no 24 hours supports forum.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

new up    ...errrror fixed  :thumbsup: 

code

Opt("GUIOnEventMode", 1)
Local $64
If @OSArch <> "X86" Then $64 = 64
Local $arr[6] = [5, "HKEY_CLASSES_ROOT" & $64, "HKEY_CURRENT_USER" & $64, "HKEY_LOCAL_MACHINE" & $64, _
        "HKEY_USERS" & $64, "HKEY_CURRENT_CONFIG" & $64]
Global $LISTREG, $TreeREG[7][2], $lastreg[1][2], $treeview, $ListView1, $Combo2, $settings, $Savgui = 0, _
        $Input1, $Combo1, $Edit1, $mamgui, $Lakey, $ddelkey, $iilastkey, $iilastvar
$lastreg[0][0] = 1
$TreeREG[0][0] = 6
$mamgui = GUICreate("Registry Editor beta 1", 680, 482)
GUISetOnEvent(-3, "__Exit")
$treeview = GUICtrlCreateTreeView(6, 60, 200, 414)
$Registry = GUICtrlCreateTreeViewItem(@ComputerName, $treeview)
GUICtrlSetImage($Registry, "shell32.dll", 16)
For $io = 1 To $arr[0]
    $TreeREG[$io][1] = $arr[$io]
    $TreeREG[$io][0] = GUICtrlCreateTreeViewItem($arr[$io], $Registry)
    GUICtrlSetOnEvent($TreeREG[$io][0], "Goreg")
    GUICtrlSetImage($TreeREG[$io][0], "shell32.dll", 4)
Next
$ListView1 = GUICtrlCreateListView("name|type|value", 210, 60, 465, 414)
$settings = GUICtrlCreateContextMenu($ListView1)
GUICtrlCreateMenuItem("Edit", $settings)
GUICtrlSetOnEvent(-1, "modkey")
GUICtrlCreateMenuItem("New value", $settings)
GUICtrlSetOnEvent(-1, "Newkey")
GUICtrlCreateMenuItem("Delete", $settings)
GUICtrlSetOnEvent(-1, "dellkey")
$Combo1 = GUICtrlCreateCombo("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", 8, 22, 593, 25)
GUICtrlCreateButton("GO", 608, 20, 67, 25)
GUICtrlSetOnEvent(-1, "GO")
GUISetState()

While 1
    Sleep(999)
WEnd

Func __Exit()
    Exit
EndFunc   ;==>__Exit
Func GO()
    Local $idcrlr, $getallreg, $bb, $p, $id
    $idcrlr = GUICtrlRead($Combo1)
    GUICtrlSetData($Combo1, $idcrlr)
    If StringRight($idcrlr, 1) <> "\" Then $idcrlr = $idcrlr & "\"
    $p = StringSplit($idcrlr, "\", 1)
    For $zer = 1 To $p[0] - 1
        $id = regone($bb & $p[$zer])
        If $id <> 0 Then
            $getallreg = GetnumVal($bb & $p[$zer])
        Else
            $id = Gettrell($bb & $p[$zer], 1, 0)
            $getallreg = GetnumKey($bb & $p[$zer])
        EndIf
        Setvar($bb & $p[$zer], $getallreg, $id)
        GUICtrlSetState($id, 1024 + 512 + 256)
        $bb &= $p[$zer] & "\"
    Next
EndFunc   ;==>GO
Func Goreg()
    Local $idcrlr, $Readcrlr, $getallreg, $idd
    $idcrlr = GUICtrlRead($treeview)
    $Readcrlr = Gettrell($idcrlr, 0, 1)
    $idd = regone($Readcrlr)
    If $idd <> 0 Then
        $getallreg = GetnumVal($Readcrlr)
    Else
        $getallreg = GetnumKey($Readcrlr)
        GUICtrlSetData($Combo1, $Readcrlr)
    EndIf
    Setvar($Readcrlr, $getallreg, $idcrlr)
    GUICtrlSetState($idcrlr, 1024 + 512 + 256)
EndFunc   ;==>Goreg
Func Newkey()
    Local $idcrlr, $Readcrlr
    $idcrlr = GUICtrlRead($treeview)
    $Readcrlr = Gettrell($idcrlr, 0, 1)
    If $Readcrlr = False Then Return
    If Not WinExists($Savgui) Then mkGui($Readcrlr)
EndFunc   ;==>Newkey
Func mkGui($zzkey, $namval = "New value", $zztyp = "REG_SZ", $zzval = "", $mod = 0)
    $ddelkey = $mod
    If $mod = 1 Then
        $iilastkey = $zzkey
        $iilastvar = $namval
    EndIf
    $Savgui = GUICreate("", 363, 242, -1, -1, -1, -1, $mamgui)
    GUISetOnEvent(-3, "__Exitsavgui")
    $Lakey = $zzkey
    GUICtrlCreateLabel(".." & StringRight($Lakey, 60), 16, 8, 332, 17)
    GUICtrlCreateLabel("name", 16, 42, 30, 17)
    GUICtrlCreateLabel("Type", 16, 72, 28, 17)
    $Input1 = GUICtrlCreateInput($namval, 80, 40, 273, 21)
    $Combo2 = GUICtrlCreateCombo($zztyp, 80, 70, 273, 25, 2097155)
    GUICtrlSetData($Combo2, StringReplace(regtype(), $zztyp & "|", ""))
    $Edit1 = GUICtrlCreateEdit($zzval, 9, 104, 343, 97)
    GUICtrlCreateButton("Save", 272, 208, 75, 25)
    GUICtrlSetOnEvent(-1, "save")
    GUISetState()
EndFunc   ;==>mkGui
Func __Exitsavgui()
    GUIDelete($Savgui)
EndFunc   ;==>__Exitsavgui
Func modkey()
    Local $idcrlr, $Readcrlr, $getvar
    $idcrlr = GUICtrlRead($treeview)
    $getvar = GUICtrlRead(GUICtrlRead($ListView1))
    If $getvar = "" Then Return
    $Readcrlr = Gettrell($idcrlr, 0, 1)
    $split = StringSplit($getvar, "|", 1)
    If Not WinExists($Savgui) Then mkGui($Readcrlr, $split[1], $split[2], $split[3], 1)
EndFunc   ;==>modkey
Func save()
    Local $valuename = GUICtrlRead($Input1), $Typekey = GUICtrlRead($Combo2), $vallt = GUICtrlRead($Edit1)
    If $ddelkey = 1 Then
        Local $Frage = MsgBox(262144 + 36, "QUESTION", "Are you sure you want to Change this key " & $iilastvar, 0, $mamgui)
        If $Frage = 7 Then Return
        autdelkey($iilastkey, $iilastvar, 0)
    EndIf
    autddkeytt($Lakey, $valuename, $Typekey, $vallt)
    __Exitsavgui()
EndFunc   ;==>save
Func dellkey()
    Local $idcrlr, $Readcrlr, $getvar
    $idcrlr = GUICtrlRead($treeview)
    $getvar = GUICtrlRead(GUICtrlRead($ListView1))
    If $getvar = "" Then Return
    $Readcrlr = Gettrell($idcrlr, 0, 1)
    $split = StringSplit($getvar, "|", 1)
    autdelkey($Readcrlr, $split[1])
EndFunc   ;==>dellkey
Func Setvar($nvar, $sreg, $crl)
    Local $mm, $pl = 1, $pppp = 0
    If IsArray($LISTREG) Then Delelelist()
    If $sreg[0] <> "" Then
        $mm = StringSplit($sreg[0], "\@/", 1)
        Dim $LISTREG[$mm[0] + 1]
        $LISTREG[0] = $mm[0]
        For $iu = 1 To $mm[0] - 1
            $LISTREG[$iu] = GUICtrlCreateListViewItem($mm[$iu], $ListView1) ;
        Next
    EndIf
    If $sreg[1] <> "" Then
        $mm = StringSplit($sreg[1], "\@/", 1)
        $pl = $TreeREG[0][0]
        ReDim $TreeREG[$mm[0] + $pl][2]
        $TreeREG[0][0] = $mm[0] + $pl - 1
        For $iu = $pl To $TreeREG[0][0] - 1
            $pppp += 1
            $TreeREG[$iu][0] = GUICtrlCreateTreeViewItem($mm[$pppp], $crl)
            GUICtrlSetOnEvent($TreeREG[$iu][0], "Goreg")
            GUICtrlSetImage($TreeREG[$iu][0], "shell32.dll", 4)
            $TreeREG[$iu][1] = $nvar & "\" & $mm[$pppp]
        Next
    EndIf
EndFunc   ;==>Setvar
Func regone($zreg)
    For $i = 1 To $lastreg[0][0] - 1
        If $lastreg[$i][0] = $zreg Then Return $lastreg[$i][1]
    Next
    ReDim $lastreg[$lastreg[0][0] + 1][2]
    $lastreg[$lastreg[0][0]][0] = $zreg
    $lastreg[$lastreg[0][0]][1] = Gettrell($zreg, 1, 0)
    $lastreg[0][0] = $lastreg[0][0] + 1
    Return 0
EndFunc   ;==>regone
Func Gettrell($teext, $op1, $op2)
    For $i = $TreeREG[0][0] - 1 To 1 Step -1
        If $TreeREG[$i][$op1] = $teext Then Return $TreeREG[$i][$op2]
    Next
EndFunc   ;==>Gettrell
Func Delelelist()
    For $i = $LISTREG[0] - 1 To 1 Step -1
        GUICtrlDelete($LISTREG[$i])
    Next
    $LISTREG = ""
EndFunc   ;==>Delelelist
Func regtype($op = 0)
    Local $temp, $Typekey[11] = ["REG_NONE", "REG_SZ", "REG_EXPAND_SZ", "REG_BINARY", "REG_DWORD", "REG_DWORD_BIG_ENDIAN", "REG_LINK", _
            "REG_MULTI_SZ", "REG_RESOURCE_LIST", "REG_FULL_RESOURCE_DESCRIPTOR", "REG_RESOURCE_REQUIREMENTS_LIST"]
    If $op = 1 Then Return $Typekey
    For $opi = 1 To 10
        $temp &= $Typekey[$opi] & "|"
    Next
    Return $temp
EndFunc   ;==>regtype
Func GetnumKey($skey)
    Local $i = 0, $rreg[2], $az
    $az = GetnumVal($skey)
    $rreg[0] = $az[0]
    While True
        $i += 1
        Local $var = RegEnumKey($skey, $i)
        If @error <> 0 Then ExitLoop
        $rreg[1] &= $var & "\@/"
    WEnd
    Return $rreg
EndFunc   ;==>GetnumKey
Func GetnumVal($skey)
    Local $z = 0, $zz[2], $var, $readreg, $extended, $type = regtype(1)
    While True
        $z += 1
        Local $var = RegEnumVal($skey, $z)
        If @error <> 0 Then ExitLoop
        $extended = @extended
        If $var = "" Then
            $var = "(Default)"
            $readreg = "(Value not set)"
        Else
            $readreg = RegRead($skey, $var)
        EndIf
        $zz[0] &= $var & "|" & $type[$extended] & "|" & $readreg & "\@/"
    WEnd
    $zz[1] = ""
    Return $zz
EndFunc   ;==>GetnumVal
Func autddkeytt($aakay, $aavar, $aaTypekey, $aavallt)
    RegWrite($aakay, $aavar, $aaTypekey, $aavallt)
    Goreg()
EndFunc   ;==>autddkeytt
Func autdelkey($aakay, $aavar, $QUES = 1)
    If $QUES = 1 Then
        Local $Frage = MsgBox(262144 + 36, "QUESTION", "Are you sure you want to delete this key " & $aavar, 0, $mamgui)
        If $Frage = 7 Then Return
    EndIf
    RegDelete($aakay, $aavar)
    Goreg()
EndFunc   ;==>autdelkey
Edited by Mrbenkali

Share this post


Link to post
Share on other sites

Can you describe what caused the error? Maybe it is useful for other users in the future.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

i love autoit  :ILA2: 

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

 

new up    ...errrror fixed  :thumbsup: 

 

 
*option
-create key
-delete key
-edit value
-create value
-delete value
 

code

Opt("GUIOnEventMode", 1)
Local $Registry, $allkey = allkey()
Global $LISTREG, $TreeREG[6][2], $lastreg[1][2], $treeview, $ListView1, $Combo2, $settings, $Savgui = 0, _
        $Input1, $Combo1, $Edit1, $mamgui, $Lakey, $ddelkey, $iilastkey, $iilastvar
$lastreg[0][0] = 1
$TreeREG[0][0] = 6
$mamgui = GUICreate("Registry Editor beta 1 by celtic88 devpoint", 680, 482)
GUISetOnEvent(-3, "__Exit")
$treeview = GUICtrlCreateTreeView(6, 60, 200, 414, 8388662)
$settings2 = GUICtrlCreateContextMenu($treeview)
GUICtrlCreateMenuItem("Create key", $settings2)
GUICtrlSetOnEvent(-1, "Newkey")
GUICtrlCreateMenuItem("Delete Selected key", $settings2)
GUICtrlSetOnEvent(-1, "ddelkey")
$Registry = GUICtrlCreateTreeViewItem(@ComputerName, $treeview)
For $io = 1 To $allkey[0]
    $TreeREG[$io][1] = $allkey[$io]
    $TreeREG[$io][0] = GUICtrlCreateTreeViewItem($allkey[$io], $Registry)
    GUICtrlSetOnEvent($TreeREG[$io][0], "Goreg")
Next
GUICtrlSetState($Registry, 1024)
$ListView1 = GUICtrlCreateListView("name|type|value", 210, 60, 465, 414)
$settings = GUICtrlCreateContextMenu($ListView1)
GUICtrlCreateMenuItem("Refresh", $settings)
GUICtrlSetOnEvent(-1, "Goreg")
GUICtrlCreateMenuItem("Edit", $settings)
GUICtrlSetOnEvent(-1, "modkey")
GUICtrlCreateMenuItem("New value", $settings)
GUICtrlSetOnEvent(-1, "Newvar")
GUICtrlCreateMenuItem("Delete", $settings)
GUICtrlSetOnEvent(-1, "dellkey")
$Combo1 = GUICtrlCreateCombo("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", 8, 22, 593, 25)
GUICtrlCreateButton("GO", 608, 20, 67, 25)
GUICtrlSetOnEvent(-1, "GO")
GUISetState()

While 1
    Sleep(999)
WEnd

Func __Exit()
    Exit
EndFunc   ;==>__Exit
Func GO()
    Local $idcrlr, $getallreg, $bb, $p, $id
    $idcrlr = GUICtrlRead($Combo1)
    GUICtrlSetData($Combo1, $idcrlr)
    If StringRight($idcrlr, 1) <> "\" Then $idcrlr = $idcrlr & "\"
    $p = StringSplit($idcrlr, "\", 1)
    For $zer = 1 To $p[0] - 1
        $id = regone($bb & $p[$zer])
        If $id <> 0 Then
            $getallreg = GetnumVal($bb & $p[$zer])
        Else
            $id = Gettrell($bb & $p[$zer], 1, 0)
            $getallreg = GetnumKey($bb & $p[$zer])
        EndIf
        Setvar($bb & $p[$zer], $getallreg, $id)
        GUICtrlSetState($id, 1024 + 512 + 256)
        $bb &= $p[$zer] & "\"
    Next
EndFunc   ;==>GO
Func Goreg()
    Local $idcrlr, $Readcrlr, $getallreg, $idd
    $idcrlr = GUICtrlRead($treeview)
    $Readcrlr = Gettrell($idcrlr, 0, 1)
    If $Readcrlr = False Then Return
    $idd = regone($Readcrlr)
    If $idd <> 0 Then
        $getallreg = GetnumVal($Readcrlr)
    Else
        $getallreg = GetnumKey($Readcrlr)
        GUICtrlSetData($Combo1, $Readcrlr, $Readcrlr)
    EndIf
    Setvar($Readcrlr, $getallreg, $idcrlr)
    GUICtrlSetState($idcrlr, 1024 + 512 + 256)
EndFunc   ;==>Goreg
Func Newvar()
    Local $idcrlr, $Readcrlr
    $idcrlr = GUICtrlRead($treeview)
    $Readcrlr = Gettrell($idcrlr, 0, 1)
    If $Readcrlr = False Then Return
    If Not WinExists($Savgui) Then mkGui($Readcrlr)
EndFunc   ;==>Newvar
Func Newkey()
    Local $idcrlr, $Readcrlr, $zio[2], $varinp
    $zio[0] = ""
    $idcrlr = GUICtrlRead($treeview)
    $Readcrlr = Gettrell($idcrlr, 0, 1)
    If $Readcrlr = False Then Return
    If allkey($Readcrlr) = 1 Then Return
    $varinp = InputBox("key Name ?", "..." & StringRight($Readcrlr, 50) & "\", "New key", "", 332, 150, Default, Default, 99, $mamgui)
    If $varinp = "" Then Return
    $zio[1] = $varinp & "\@/"
    autddkeytt($Readcrlr & "\" & $varinp, "", "", "")
    Setvar($Readcrlr, $zio, $idcrlr)
    GUICtrlSetState($idcrlr, 1024)
EndFunc   ;==>Newkey
Func ddelkey()
    Local $idcrlr, $Readcrlr, $zio[2], $varinp
    $zio[0] = ""
    $idcrlr = GUICtrlRead($treeview)
    $Readcrlr = Gettrell($idcrlr, 0, 1)
    If $Readcrlr = False Then Return
    If allkey($Readcrlr) = 1 Then Return
    Local $Frage = MsgBox(262144 + 36, "QUESTION", "Are you sure you want to delete this key " & @CR & $Readcrlr, 0, $mamgui)
    If $Frage = 7 Then Return
    autdelkey($Readcrlr, "")
    GUICtrlDelete($idcrlr)
EndFunc   ;==>ddelkey
Func mkGui($zzkey, $namval = "New value", $zztyp = "REG_SZ", $zzval = "", $mod = 0)
    $ddelkey = $mod
    If $mod = 1 Then
        $iilastkey = $zzkey
        $iilastvar = $namval
    EndIf
    $Lakey = $zzkey
    $Savgui = GUICreate("..." & StringRight($Lakey, 40), 363, 272, -1, -1, 0x00080000, -1, $mamgui)
    GUISetOnEvent(-3, "__Exitsavgui")
    GUICtrlCreateLabel("name", 16, 32, 30, 17)
    GUICtrlCreateLabel("Type", 16, 62, 28, 17)
    $Input1 = GUICtrlCreateInput($namval, 80, 30, 273, 21)
    $Combo2 = GUICtrlCreateCombo($zztyp, 80, 60, 273, 25, 2097155)
    GUICtrlSetData($Combo2, StringReplace(regtype(), $zztyp & "|", ""))
    $Edit1 = GUICtrlCreateEdit($zzval, 9, 94, 343, 97)
    GUICtrlCreateButton("Save", 272, 198, 75, 25)
    GUICtrlSetOnEvent(-1, "save")
    GUISetState()
EndFunc   ;==>mkGui
Func __Exitsavgui()
    GUIDelete($Savgui)
EndFunc   ;==>__Exitsavgui
Func modkey()
    Local $idcrlr, $Readcrlr, $getvar
    $idcrlr = GUICtrlRead($treeview)
    $getvar = GUICtrlRead(GUICtrlRead($ListView1))
    If $getvar = "" Then Return
    $Readcrlr = Gettrell($idcrlr, 0, 1)
    $split = StringSplit($getvar, "|", 1)
    If Not WinExists($Savgui) Then mkGui($Readcrlr, $split[1], $split[2], $split[3], 1)
EndFunc   ;==>modkey
Func save()
    Local $valuename = GUICtrlRead($Input1), $Typekey = GUICtrlRead($Combo2), $vallt = GUICtrlRead($Edit1)
    If $ddelkey = 1 Then
        Local $Frage = MsgBox(262144 + 36, "QUESTION", "Are you sure you want to Change this key " & $iilastvar, 0, $Savgui)
        If $Frage = 7 Then Return
        autdelkey($iilastkey, $iilastvar)
    EndIf
    autddkeytt($Lakey, $valuename, $Typekey, $vallt)
    Goreg()
    __Exitsavgui()
EndFunc   ;==>save
Func dellkey()
    Local $idcrlr, $Readcrlr, $getvar
    $idcrlr = GUICtrlRead($treeview)
    $getvar = GUICtrlRead(GUICtrlRead($ListView1))
    If $getvar = "" Then Return
    $Readcrlr = Gettrell($idcrlr, 0, 1)
    $split = StringSplit($getvar, "|", 1)
    Local $Frage = MsgBox(262144 + 36, "QUESTION", "Are you sure you want to delete this key " & $split[1], 0, $mamgui)
    If $Frage = 7 Then Return
    autdelkey($Readcrlr, $split[1])
    Goreg()
EndFunc   ;==>dellkey
Func Setvar($nvar, $sreg, $crl)
    Local $mm, $pl, $pppp = 0, $zzmm, $type = regtype(1)
    If IsArray($LISTREG) Then Delelelist()
    If $sreg[0] <> "" Then
        $mm = StringSplit($sreg[0], "\@/", 1)
        Dim $LISTREG[$mm[0] + 1]
        $LISTREG[0] = $mm[0]
        For $iu = 1 To $mm[0] - 1
            $zzmm = StringSplit($mm[$iu], "|", 1)
            $LISTREG[$iu] = GUICtrlCreateListViewItem($zzmm[1] & "|" & $type[$zzmm[2]] & "|" & $zzmm[3], $ListView1) ;
        Next
    EndIf
    If $sreg[1] <> "" Then
        $mm = StringSplit($sreg[1], "\@/", 1)
        $pl = $TreeREG[0][0]
        ReDim $TreeREG[($mm[0]) - 1 + $pl][2]
        $TreeREG[0][0] = ($mm[0]) - 1 + $pl
        For $iu = $pl To $TreeREG[0][0] - 1
            $pppp += 1
            $TreeREG[$iu][0] = GUICtrlCreateTreeViewItem($mm[$pppp], $crl)
            GUICtrlSetOnEvent($TreeREG[$iu][0], "Goreg")
            $TreeREG[$iu][1] = $nvar & "\" & $mm[$pppp]
        Next
    EndIf
EndFunc   ;==>Setvar
Func regone($zreg)
    For $i = 1 To $lastreg[0][0] - 1
        If $lastreg[$i][0] = $zreg Then Return $lastreg[$i][1]
    Next
    ReDim $lastreg[$lastreg[0][0] + 1][2]
    $lastreg[$lastreg[0][0]][0] = $zreg
    $lastreg[$lastreg[0][0]][1] = Gettrell($zreg, 1, 0)
    $lastreg[0][0] = $lastreg[0][0] + 1
    Return 0
EndFunc   ;==>regone
Func Gettrell($teext, $op1, $op2)
    For $i = $TreeREG[0][0] - 1 To 1 Step -1
        If $TreeREG[$i][$op1] = $teext Then Return $TreeREG[$i][$op2]
    Next
EndFunc   ;==>Gettrell
Func Delelelist()
    For $i = $LISTREG[0] - 1 To 1 Step -1
        GUICtrlDelete($LISTREG[$i])
    Next
    $LISTREG = ""
EndFunc   ;==>Delelelist
Func allkey($op = False)
    Local $64
    If @OSArch <> "X86" Then $64 = 64
    Local $arr[6] = [5, "HKEY_CLASSES_ROOT" & $64, "HKEY_CURRENT_USER" & $64, "HKEY_LOCAL_MACHINE" & $64, _
            "HKEY_USERS" & $64, "HKEY_CURRENT_CONFIG" & $64]
    If $op = False Then Return $arr
    For $uyt = 1 To 5
        If $arr[$uyt] = $op Then Return 1
    Next
    Return 0
EndFunc   ;==>allkey
Func regtype($opop = 0)
    Local $temp, $Typekey[11] = ["REG_NONE", "REG_SZ", "REG_EXPAND_SZ", "REG_BINARY", "REG_DWORD", "REG_DWORD_BIG_ENDIAN", "REG_LINK", _
            "REG_MULTI_SZ", "REG_RESOURCE_LIST", "REG_FULL_RESOURCE_DESCRIPTOR", "REG_RESOURCE_REQUIREMENTS_LIST"]
    If $opop = 1 Then Return $Typekey
    For $opi = 1 To 10
        $temp &= $Typekey[$opi] & "|"
    Next
    Return $temp
EndFunc   ;==>regtype
;;;;;;;; SERVER :p
Func GetnumKey($skey)
    Local $i = 0, $rreg[2], $az
    $az = GetnumVal($skey)
    $rreg[0] = $az[0]
    While True
        $i += 1
        Local $var = RegEnumKey($skey, $i)
        If @error <> 0 Then ExitLoop
        $rreg[1] &= $var & "\@/"
    WEnd
    Return $rreg
EndFunc   ;==>GetnumKey
Func GetnumVal($skey)
    Local $z = 0, $zz[2], $var, $readreg, $extended
    While True
        $z += 1
        Local $var = RegEnumVal($skey, $z)
        If @error <> 0 Then ExitLoop
        $extended = @extended
        If $var = "" Then
            $var = "(Default)"
            $readreg = "(Value not set)"
        Else
            $readreg = RegRead($skey, $var)
        EndIf
        $zz[0] &= $var & "|" & $extended & "|" & $readreg & "\@/"
    WEnd
    $zz[1] = ""
    Return $zz
EndFunc   ;==>GetnumVal
Func autddkeytt($aakay, $aavar, $aaTypekey, $aavallt)
    RegWrite($aakay, $aavar, $aaTypekey, $aavallt)
EndFunc   ;==>autddkeytt
Func autdelkey($aakay, $aavar)
    If $aavar <> "" Then
        RegDelete($aakay, $aavar)
    Else
        RegDelete($aakay)
    EndIf
EndFunc   ;==>autdelkey
Edited by Mrbenkali

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0