Jump to content

help me ! in reg key


Gerald
 Share

Recommended Posts

hi i have some question regards to my working program this is my code

#include <GUIConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 361, 365, 317, 191)
$Input1 = GUICtrlCreateInput("Input1", 24, 40, 169, 21)
$Edit1 = GUICtrlCreateList("", 8, 120, 337, 217)
GUICtrlSetData(-1, "")
$Button1 = GUICtrlCreateButton("Button1", 200, 32, 75, 25, 0)
$Button3 = GUICtrlCreateButton("Button3", 280, 32, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  case $Button1
   Readreg()
  Case $Button3
   orc()
EndSwitch
WEnd

Func Readreg()
For $i= 1 to 100000

$var = RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run",$i)
If @error <> 0 then ExitLoop


GUICtrlSetData($Edit1,$var)
Next

EndFunc

and my GUICtrlSetData result is only the value name of a regkey can possible to show the type and the date value in regkey .... ?

Link to comment
Share on other sites

In fact, it's a "parsing" problem.

RegEnumVal function gives you the list of keys inside HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run regkey, not the values of those keys.

It's up to you to parse (get the value of) the "$var" returned key using RegRead function with something like : $value = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\",$var) and then perform the GUICtrlSetData action.

Link to comment
Share on other sites

The code you provided will change the value of your ctrl "GUICtrlSetData($Edit1,$var)" on each iteration of the loop - so it will only be the value of the last item in your "Run" list. You may want to change that, but here is some code to get you started on your question.

For $i = 1 to 10 ; change this value if you want to show more items
$var1 = RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $i)
if @error <> 0 Then ExitLoop
$var2 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $var1)
Switch @extended
Case 0
  $type = 'REG_NONE'
Case 1
  $type = 'REG_SZ'
Case 2
  $type = 'REG_EXPAND_SZ'
Case 3
  $type = 'REG_BINARY'
Case 4
  $type = 'REG_DWORD'
Case 5
  $type = 'REG_DWORD_BIG_ENDIAN'
Case 6
  $type = 'REG_LINK'
Case 7
  $type = 'REG_MULTI_SZ'
Case 8
  $type = 'REG_RESOURCE_LIST'
Case 9
  $type = 'REG_FULL_RESOURCE_DESCRIPTOR'
Case 10
  $type = 'REG_RESOURCE_REQUIREMENTS_LIST'
EndSwitch
MsgBox(4096, @extended,  'Name = ' & $var1 & @CRLF & 'Type = ' & $type & @CRLF & 'Value = ' & $var2 )
next

edit spelling

Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

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