RootKey是注册表的根键值,比如运行regedit后看到的HKEY_USERS,HKEY_LOCAL_MACHINE就是RootKey,在TRegIniFile中缺省的RootKey是HKEY_USERS.
下面的例子是TRegistry的,TRegIniFile也差不多
void __fastcall TfrmMainForm::WriteToMyRegistry(int table_count)
{
//TODO: Add your source code here
TRegistry *MyRegistry=new TRegistry;
MyRegistry->RootKey=HKEY_LOCAL_MACHINE; //改变缺省Rootkey
if(!MyRegistry->OpenKey("Software\Microsoft\Windows\CurrentVersion\Run",true)) //打开主键
//这样双引号里面的东西就变成了CurrentKey
{
Application->MessageBox("注册表内容无效", "读取注册表出错",MB_ICONERROR);
MyRegistry->CloseKey();
delete MyRegistry;
return;
}
MyRegistry->WriteString("myrun","c:\sthvcd\sthvcd.exe");
MyRegistry->CloseKey();
delete MyRegistry;http://www.qqread.com/registry/d349915.html 相关图文阅读
频道图文推荐
健 康 咨 询
时 尚 咨 询
相关专题
- 注册表知识手册 (773篇文章)
- 注册表操作专题 (773篇文章)
- C/C++技术专题 (1640篇文章)
- Java编程开发手册 (8321篇文章)
- 注册表编程 (35篇文章)
- 注册表操作 (312篇文章)
- 注册表修复 (194篇文章)
- 网页恶意代码清除&修复 (214篇文章)
- 修改注册表关闭Windows系统更新提醒 (0次浏览)



