Use the Tregistry Class [1]: displays the items under each primary key

Source: Internet
Author: User
{Primary key} hkey_classes_root {file type information} HKEY_CURRENT_USER {current user information} HKEY_LOCAL_MACHINE {hardware and software information} HKEY_USERS {all user information} hkey_current_config {current configuration information} {constant defined by Delphi} hkey_classes_root = DWORD ($80000000 ); HKEY_CURRENT_USER = DWORD ($80000001); HKEY_LOCAL_MACHINE = DWORD ($80000002); HKEY_USERS = DWORD ($80000003); hkey_performance_data = DWORD ($80000004); hkey_current_config = DWORD ($80000005 ); hkey_dyn_data = DWORD ($80000006 );

  

In this example:


Code File:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls, extctrls; Type tform1 = Class (tform) listbox1: tlistbox; radiogroup1: tradiogroup; Procedure formcreate (Sender: tobject); Procedure radiogroup1click (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} uses registry; Procedure tform1.formcreate (Sender: tobject); begin listbox1.align: = alleft; radiogroup1.items. commatext: = 'HKEY-classes-root, '+ 'HKEY-current-user,' + 'HKEY-local-machine, '+ 'HKEY-users, '+ 'HKEY-CURRENT-CONFIG'; end; Procedure tform1.radiogroup1click (Sender: tobject); var REG: Tregistry; begin REG: = Tregistry. create; Case radiogroup1.itemindex of 0: Reg. rootkey: = hkey_classes_root; 1: Reg. rootkey: = HKEY_CURRENT_USER; {This is the default value of rootkey} 2: Reg. rootkey: = HKEY_LOCAL_MACHINE; 3: Reg. rootkey: = HKEY_USERS; 4: Reg. rootkey: = hkey_current_config; end; Reg. openkey ('', false); Reg. getkeynames (listbox1.items); Reg. closekey; Reg. free; end.
 
   
 

Form file:

 
Object form1: tform1 left = 0 Top = 0 caption = 'form1' clientheight = 176 clientwidth = 325 color = clbtnface font. charset = default_charset font. color = clwindowtext font. height =-11 font. name = 'tahoma 'font. style = [] oldcreateorder = false oncreate = formcreate pixelsperinch = 96 textheight = 13 object listbox1: tlistbox left = 0 Top = 8 width = 153 Height = 134 itemheight = 13 taborder = 0 end object radiogroup1: tradiogroup left = 159 Top = 8 width = 158 Height = 160 caption = 'radiogroup1' taborder = 1 onclick = radiogroup1click endend

  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.