Jump to content

Add registry value list to list and ini file?


telmob
 Share

Recommended Posts

Hello again.

How can i add a list of registry values to a list box/ini file?

For example, i have this in my registry:

'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\', '1', "REG_SZ", 'value1'

'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\', '2', "REG_SZ", 'value2'

'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\', '3', "REG_SZ", 'value3'

I want to read all the values and add them to the list in my GUI and to save them to a ini file.

This code is a bad/imcomplete example of what i want to achieve:

#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 615, 438, 451, 248)
$List1 = GUICtrlCreateList("", 192, 128, 233, 97)
GUISetState(@SW_SHOW)

getvar()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd

Func getvar()
For $i = 1 to 100
$var = RegEnumVal("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun", $i)
$varfile=RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun", $var)
if @error <> 0 Then ContinueLoop

Next
GUICtrlSetData($List1, $varFile)
EndFunc

P.S.: Please forgive if the example is not very good, its 2am and i'm about to fall to the side right about now..... :)

Link to comment
Share on other sites

Hi,

Here you go :

#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 615, 438, 451, 248)
$List1 = GUICtrlCreateList("", 192, 128, 233, 97)
GUISetState(@SW_SHOW)

getvar()

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd

Func getvar()
Local $sListContent, $var, $varfile

For $i = 1 To 100
$var = RegEnumVal("HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesExplorerDisallowRun", $i)
If @error Then ExitLoop

$varfile = RegRead("HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesExplorerDisallowRun", $var)

$sListContent &= $varfile & "|"
Next

GUICtrlSetData($List1, StringTrimRight($sListContent, 1))
EndFunc   ;==>getvar

Br, FireFox.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...