请看下面的程序,帮我看看哪里有问题??不管在注册表的
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run里有没有我加入的chartsoft键。用RegF.KeyExists('chartsoft')返回都是false,我不明白为什么,还请大虾指教。
begin
pathname := application.ExeName ;
RegF := TRegistry.Create;
RegF.RootKey := HKEY_LOCAL_MACHINE;
if checkbox1.Checked = true then
begin
try
RegF.OpenKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Run',True);
exist:= RegF.KeyExists('chartsoft'); if exist = false then
Regf.WriteString ('chartsoft',pathname);
except
application.Destroy ;
end;
Regf.CloseKey ;
RegF.Free ;
end;
if checkbox1.checked = false then
begin
try
RegF.OpenKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Run',True);
exist:= RegF.KeyExists('chartsoft');
if exist=true then
begin
delete:= Regf.DeleteKey('chartsoft');
if delete=true then
showmessage('已经关闭自动启动')
else showmessage('关闭自动启动失败');
end;
except
application.Destroy ;
end;
Regf.CloseKey ;
RegF.Free ;
end;
end;
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run里有没有我加入的chartsoft键。用RegF.KeyExists('chartsoft')返回都是false,我不明白为什么,还请大虾指教。
begin
pathname := application.ExeName ;
RegF := TRegistry.Create;
RegF.RootKey := HKEY_LOCAL_MACHINE;
if checkbox1.Checked = true then
begin
try
RegF.OpenKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Run',True);
exist:= RegF.KeyExists('chartsoft'); if exist = false then
Regf.WriteString ('chartsoft',pathname);
except
application.Destroy ;
end;
Regf.CloseKey ;
RegF.Free ;
end;
if checkbox1.checked = false then
begin
try
RegF.OpenKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Run',True);
exist:= RegF.KeyExists('chartsoft');
if exist=true then
begin
delete:= Regf.DeleteKey('chartsoft');
if delete=true then
showmessage('已经关闭自动启动')
else showmessage('关闭自动启动失败');
end;
except
application.Destroy ;
end;
Regf.CloseKey ;
RegF.Free ;
end;
end;
解决方案 »
- 求助,各位大大 TNMUDP控件 是哪个控件板上的啊,谢谢!
- 心情不好散分!!!
- 如何控制TreeView,当某个节点处于可编辑时,限制输入的字符数,例如只可以输入12个字,如果超过则不给输入
- 请告知二者区别,如何转换
- 请问高人如何将SQLSERVER数据导出至ACCESS
- 本人正主持一项目,很急...
- 想学地理信息系统,说搞过GIS?给个源程序学学好吗?
- 如何导入数据!
- 在toolbar上放一个BitBtn,如何让它是flat型的呢?
- 怎样串转换?! 俺第一天学DELPHI,邦邦忙!
- 原来很不习惯delphi的 := ,现在习惯了! :)
- 我想保留DBEDIT3.TEXT中浮点数中的两位小数
建议多利用Delphi帮助吧!很多东西是别人引进门,修行靠个人的!