Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Tue Oct 29, 2002 10:38 pm Post subject: Registry Access Demo... |
|
|
Here's a short demo on accessing the registry and
obtaining lists of keys and their values.
This demo DOES NOT write or remove anything from
the registry. To modify the registry, you can use the
REGISTRY WRITE or REGISTRY DELETE commands.
The list on the left is loaded with subkeys from:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
Some of these will have immediate keys with values (such
as "Run"), others have subkeys that also have subkeys
etc. etc. which will show no value, just the next layer of
subkeys.
Values are retrieved with @regread().
Hope this is helpful.
| Code: |
OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE By Mac
DIALOG CREATE,"Registry Demo (read only)",-1,0,500,220
DIALOG ADD,TEXT,T1,5,5,,,"Click these for a list of subkeys/values:"
DIALOG ADD,TEXT,T2,5,250,,,"The list of subkeys and values (if they exist):"
DIALOG ADD,LIST,L1,20,5,245,180,,CLICK,SORTED
DIALOG ADD,LIST,L2,20,250,245,180
rem -- Add horizontal scroll to lists --
%z = @sendmsg(@winexists(~L1),$0194,2000,0)
%z = @sendmsg(@winexists(~L2),$0194,2000,0)
DIALOG ADD,STATUS,Stat,"LOCAL,Software\Microsoft\Windows\CurrentVersion"
DIALOG SHOW
rem -- Used for retrieving keys that have SUBKEYS --
LIST REGKEYS,L1, LOCAL, Software\Microsoft\Windows\CurrentVersion
if @match(L1, "Run")
if @equal(@len(@item(L1)), 3)
goto L1CLICK
end
end
:EVLOOP
WAIT EVENT
goto @event()
:L1CLICK
LIST CLEAR, L2
rem -- Used for retrieving keys that have VALUES --
LIST REGVALS,L2, LOCAL, Software\Microsoft\Windows\CurrentVersion\@item(L1)
if @equal(@count(L2), 0)
goto EVLOOP
end
rem -- Loop thru list L2 and retrieve values of each key --
%%numkeys = @count(L2)
LIST ADD, L2, ""
LIST ADD, L2, "Values retrieved with @regread():"
LIST ADD, L2, ""
%x = 0
REPEAT
if @regread(LOCAL, Software\Microsoft\Windows\CurrentVersion\Run, @item(L2, %x))
LIST ADD, L2, @item(L2, %x) = @regread(LOCAL, Software\Microsoft\Windows\CurrentVersion\Run, @item(L2, %x))
end
%x = @succ(%x)
UNTIL @equal(%x, %%numkeys)
goto EVLOOP
:CLOSE
EXIT
|
Cheers, Mac _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|