| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 672 人关注过本帖
标题:[求助]关于操作注册表
只看楼主 加入收藏
无知的小孩
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2007-3-26
收藏
 问题点数:0 回复次数:4 
[求助]关于操作注册表
请问用delphi来操作注册表,例如说存取注册表信息怎么进行啊 ?
搜索更多相关主题的帖子: 注册表 delphi 存取 
2007-04-12 10:54
sgliuxiu
Rank: 5Rank: 5
等 级:贵宾
威 望:15
帖 子:291
专家分:0
注 册:2007-2-2
收藏
得分:0 

给个例子给你,呵呵
procedure TMainForm.FormCreate(Sender: TObject);
var Registry: TRegistry;

begin
Registry:=TRegistry.Create;
Registry.RootKey:=HKEY_LOCAL_MACHINE;
Registry.OpenKey('\SoftWare\sgliuxiu工作室\现金收费\',True);
SysDba:=Registry.ReadString('SysDba');
SysPassWord:=Registry.ReadString('SysPassWord');
BranchName:=Registry.ReadString('BranchNo');
Programmer:=Registry.ReadString('Programmer');
TerminalNo:=Registry.ReadString('TerminalNo');
Provider1:=Registry.ReadString('Provider');
IpAdress:=Registry.ReadString('IPAddress');
RemoteServer:=Registry.ReadString('Remote Server');
DefaultDatabase1:=Registry.ReadString('DefaultDatabase');
Registry.CloseKey;
Registry.Free;
end;


小猫说:给我10元钱
2007-04-12 12:21
无知的小孩
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2007-3-26
收藏
得分:0 
可是我找不到registry

2007-04-12 12:59
sgliuxiu
Rank: 5Rank: 5
等 级:贵宾
威 望:15
帖 子:291
专家分:0
注 册:2007-2-2
收藏
得分:0 

var Registry: TRegistry; registry是自己定义的变量名啊.

delphi里面的帮助文件,你看看.

If you are writing a Windows-only application and are comfortable with the structure of the system Registry, you can use TRegistry. Unlike TRegistryIniFile, which uses the same properties and methods of other ini file components, the properties and methods of TRegistry correspond more directly to the structure of the system Registry. For example, TRegistry lets you specify both the root key and subkey, while TRegistryIniFile assumes HKEY_CURRENT_USER as a root key. In addition to methods for opening, closing, saving, moving, copying, and deleting keys, TRegistry lets you specify the access level you want to use.

Note

TRegistry is not available for cross-platform programming.

The following example retrieves a value from a registry entry:

function GetRegistryValue(KeyName: string): string;
var
Registry: TRegistry;
begin
Registry := TRegistry.Create(KEY_READ);
try
Registry.RootKey = HKEY_LOCAL_MACHINE;
// False because we do not want to create it if it doesn't exist
Registry.OpenKey(KeyName, False);
Result := Registry.ReadString('VALUE1');
finally
Registry.Free;
end;
end;


小猫说:给我10元钱
2007-04-12 15:49
无知的小孩
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2007-3-26
收藏
得分:0 
太感谢楼上了 ,好多都不懂,书上也没说清楚
这个送您,呵呵

2007-04-12 17:12
快速回复:[求助]关于操作注册表
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.021768 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved