delphi - Why doesn't my code find any registry keys? -
i want list usb vids registry, , wrote following delphi code:
procedure findusbvids(vids: tstrings); var reg1: tregistry; begin reg1 := tregistry.create; try reg1.rootkey := hkey_local_machine; reg1.openkey('system\currentcontrolset\enum\usb', false); reg1.getkeynames(vids); reg1.free; end; end; procedure tform1.button6click(sender: tobject); findusbvids(memo2.lines); end;
unfortunately memo remains empty. triple-checked key, exists , has couple dozen subkeys. doing wrong?
(note: i'm not sure right way find usb vids, that's not point. it's i'm puzzled why code doesn't produce result.)
you asking write access registry key. use openkeyreadonly
instead of openkey
.
Comments
Post a Comment