首页 > 学院 > 开发设计 > 正文

读取注册表中一个子键下的所有子键

2019-11-17 05:36:19
字体:
来源:转载
供稿:网友

  #include <TRegistry.hpp>

TRegistry &temp=*new TRegistry();
TStringList &listvalue= *new TStringList();
TStringList &listkey =*new TStringList();
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
String tr;
temp.RootKey=HKEY_CURRENT_USER;
temp.OpenKey("software//microsoft//windows//currentversion//PINTLGNT",true);
temp.GetKeyNames(&listkey);
for(int i=0;i<listkey.Count;i++)
   {
   Memo1->Lines->Add(listkey.Strings[i]);
   }
temp.CloseKey();
temp.RootKey=HKEY_CURRENT_USER;
temp.OpenKey("software//microsoft//windows//currentversion//PINTLGNT",true);
temp.GetValueNames(&listvalue);
for(int i=0;i<listvalue.Count;i++)
   {
   Memo1->Lines->Add(listvalue.Strings[i]+ String("----------->") + temp.ReadString(listvalue.Strings[i]));
   }
temp.CloseKey();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormDestroy(TObject *Sender)
{
delete &temp;
delete &listvalue;
delete &listkey;
}
//--------------------------------------------------------------------------- 

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表