c++builder如何访问注册表

wld2003 2003-03-01 09:26:08
各位老大,c++builder如何访问注册表
...全文
61 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
tom_ly 2003-03-04
  • 打赏
  • 举报
回复
读:
String View;
TRegistry* Reg = new TRegistry;
Reg->RootKey = HKEY_CURRENT_USER; // 主键
if (Reg->KeyExists("Software\\Windows"))
{// 打开键
Reg->OpenKey("Software\\Windows", false);
View= Reg->ReadString("ViewSet");
Reg->CloseKey(); // 关闭键
}
wocard 2003-03-04
  • 打赏
  • 举报
回复
差不多了,都被写全了,
我走了
cdws222 2003-03-03
  • 打赏
  • 举报
回复
来晚了

顺便告诉你吧还有个TIniFile类呢
pp616 2003-03-02
  • 打赏
  • 举报
回复
有点累了。7点过了。该去睡觉了。
Sammo 2003-03-01
  • 打赏
  • 举报
回复
好快哦!
我来迟了!:)
牧牛人软件 2003-03-01
  • 打赏
  • 举报
回复
#include <registry.hpp>

读:


AnsiString Sno, Year;
int ret;

MainForm->RegistryStat=0;
const String RegKey = "\\SoftWare\\WGHSoftware\\School";
TRegistry *MyRegistry = new TRegistry();
MyRegistry->RootKey = HKEY_LOCAL_MACHINE;
try {
if(MyRegistry->OpenKey(RegKey, false)) {
RegCode=MyRegistry->ReadString("SN");
Unit=MyRegistry->ReadString("UnitName");
SysName=MyRegistry->ReadString("SystemName");
SysCaption=MyRegistry->ReadString("SystemCaption");
MyRegistry->CloseKey();
}
}

catch(ERegistryException &E) {
ShowMessage(E.Message);
delete MyRegistry;
return;
}



写:


const String RegKey = "\\SoftWare\\WGHSoftware\\School";
TRegistry *MyRegistry = new TRegistry();
MyRegistry->RootKey = HKEY_LOCAL_MACHINE;
try {
if(MyRegistry->OpenKey(RegKey, true)) {
MyRegistry->WriteString("UnitName",UnitEdit->Text);
MyRegistry->WriteString("SN",RegCodeEdit->Text);
MyRegistry->WriteString("SystemName",SysNameEdit->Text);
MyRegistry->CloseKey();
}
}
catch(ERegistryException &E) {
ShowMessage(E.Message);
delete MyRegistry;
return;
}
delete MyRegistry;
ShowMessage("注册成功!");
Label1->Caption="已注册";
gdyt007 2003-03-01
  • 打赏
  • 举报
回复
給你一個例子:
TRegistry *my=new TRegistry;
my->RootKey=HKEY_LOCAL_MACHINE;
my->OpenKey("HARDWARE\\DEVICEMAP\\SERIALCOMM",true);
COMlist->Sorted=false;
my->GetValueNames(COMlist->Items);
COMlist->Items->BeginUpdate();
for(int i=0;i<COMlist->Items->Count;i++)
COMlist->Items->Strings[i]=my->ReadString(COMlist->Items->Strings[i]);
COMlist->Items->EndUpdate();
COMlist->Sorted=true;
gdyt007 2003-03-01
  • 打赏
  • 举报
回复
首先#include <Registry.hpp>
列舉一下
ReadString
WriteString
GetDateInfo
CreatKey
DeleteKey

604

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder VCL组件使用和开发
社区管理员
  • VCL组件使用和开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧