Jump to content
Sign in to follow this  
telmob

Add registry value list to list and ini file?

Recommended Posts

telmob

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..... :)

Share this post


Link to post
Share on other sites
FireFox

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.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
telmob

WOW! Thank you so much!

I keep getting myself into these type of problems, i'll try to learn from it.

Again, thank you.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.