Fosdccf.blog.chinaunix.net
sdccf
全部博文(19283)
Linux酷软(214)
tmp(0)
PostgreSQL(93)
Solaris(383)
AIX(173)
SCOUNIX(575)
DB2(1005)
Shell(386)
C/C++(1187)
MySQL(1750)
Sybase(465)
Oracle(3695)
Informix(548)
HP-UX(0)
IBM AIX(2)
Sun Solaris(0)
BSD(1)
Linux(8597)
SCO UNIX(23)
2011年(1)
2009年(125)
2008年(19094)
2007年(63)
clifford
linky521
曾德标
fengzhan
leon_yu
mcuflowe
yt200902
guanyuji
GY123456
snow888
carlos94
丸喵喵
sean229
cxunix
可怜的猪
cqxc413
xzzgege
wb123456
分类: C/C++
2008-04-16 18:57:48
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\\Current\Version\\Run",true)) //打开主键 //这样双引号里面的东西就变成了CurrentKey { Application->MessageBox("注册表内容无效", "读取注册表出错",MB_ICONERROR); MyRegistry->CloseKey(); delete MyRegistry; return; } MyRegistry->WriteString("myrun","c:\\sthvcd\\sthvcd.exe"); MyRegistry->CloseKey(); delete MyRegistry;
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\\Current\Version\\Run",true)) //打开主键 //这样双引号里面的东西就变成了CurrentKey { Application->MessageBox("注册表内容无效", "读取注册表出错",MB_ICONERROR); MyRegistry->CloseKey(); delete MyRegistry; return; } MyRegistry->WriteString("myrun","c:\\sthvcd\\sthvcd.exe"); MyRegistry->CloseKey(); delete MyRegistry;
上一篇:技巧应用篇—C++在网页设计中的应用
下一篇:C++ Builder实现菜单显示历史文件列表
登录 注册