帮我看看下面的代码!!

warton 2002-10-16 04:18:36
var
reg: TRegistry;
begin
reg := TRegistry.Create;
reg.RootKey:=HKEY_CLASSES_ROOT;
reg.OpenKey('*\shell\xxxx\command', true);
reg.WriteString('', '"' + application.ExeName + '" "%1"');
reg.CloseKey;
reg.OpenKey('*\shell\diary', false);
reg.WriteString('', '操作(&C)');
reg.CloseKey;
reg.Free;
showmessage('DONE!');
end;

运行时说:failed to set data for "
是 reg.WriteString('', '"' + application.ExeName + '" "%1"');
的问题,但我看不出那儿错了
...全文
30 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
warton 2002-10-16
  • 打赏
  • 举报
回复
谢谢zfmich() ,按你说的改过后就可以了!!这样的话 wjohenw(天奇) 说的也对!
zfmich 2002-10-16
  • 打赏
  • 举报
回复
reg.OpenKey('*\shell\diary', false);
改为
reg.OpenKey('*\shell\diary', true);
wjohenw 2002-10-16
  • 打赏
  • 举报
回复
我把你的代码拿去运行,错误和你说的一样,但是改掉之后就是好的,没错
wjohenw 2002-10-16
  • 打赏
  • 举报
回复
reg.OpenKey('*\shell\diary', false)
该为
if reg.OpenKey('*\shell\diary', false) then

你该过来还是错了吗?

我不把你的代码那去运行,错误和你说的一样,但是改掉之后就是好的,没错
warton 2002-10-16
  • 打赏
  • 举报
回复
不是那儿的问题,是 reg.WriteString('', '"' + application.ExeName + '" "%1"');
的问题,但我看不出那儿错了
wjohenw 2002-10-16
  • 打赏
  • 举报
回复
reg.OpenKey('*\shell\xxxx\command', true);
改为
if reg.OpenKey('*\shell\xxxx\command', true) then

reg.OpenKey('*\shell\diary', false)
该为
if reg.OpenKey('*\shell\diary', false) then

通过

5,392

社区成员

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

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