关于一个写注册表的问题

huliao 2000-07-14 11:16:00
我有一段程序要把Edit2中的值写到注册表中去
procedure TForm1.Button1Click(Sender: TObject);
var
Reg: TRegistry;
begin
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_CURRENT_USER;
if Reg.OpenKey('\Control Panel\International', False)
then Edit1.Text:=Reg.WriteString('sShortDate',Edit2.Text);
finally
Reg.CloseKey;
Reg.Free;
inherited;
end;
end;
编译时老报错: Incompatible type: 'String' and 'procedure,uptyped pointer or untyped parameter'
我查了TRegistry的WriteString方法,后面的参数是String类型的为什么编译通不过呢?

BTW: inherited在这里有什么用,是必须的吗?
...全文
214 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
huliao 2000-07-14
  • 打赏
  • 举报
回复
这是一段copy来的程序,没细看,所以也不懂为什么加inherited.
kxy 2000-07-14
  • 打赏
  • 举报
回复
1)Edit.Text := Reg.WriteString('sShortDate',Edit2.Text);
WriteString是procedure ,哪有返回值?
2) finally
Reg.CloseKey;
Reg.Free;
inherited;//你加一个这个东西干吗?
end;

5,388

社区成员

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

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