uses Registry;procedure RegistryFile(bRegistry: boolean);
const
SKey = 'coolfile\shell\open\command';
var
Reg: TRegistry;
begin
Reg := TRegistry.Create;
Reg.RootKey := HKEY_CLASSES_ROOT;
if bRegistry then
begin
Reg.OpenKey('.cool', true);
Reg.WriteString('', 'coolfile');
Reg.CloseKey;
Reg.OpenKey(SKey, true);
Reg.WriteString('', Application.ExeName + ' %1');
Reg.CloseKey;
end
else begin
Reg.DeleteKey('.cool');
Reg.DeleteKey('coolfile');
end;
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST + SHCNF_FLUSH, nil, nil);
Reg.Free;
end;
const
SKey = 'coolfile\shell\open\command';
var
Reg: TRegistry;
begin
Reg := TRegistry.Create;
Reg.RootKey := HKEY_CLASSES_ROOT;
if bRegistry then
begin
Reg.OpenKey('.cool', true);
Reg.WriteString('', 'coolfile');
Reg.CloseKey;
Reg.OpenKey(SKey, true);
Reg.WriteString('', Application.ExeName + ' %1');
Reg.CloseKey;
end
else begin
Reg.DeleteKey('.cool');
Reg.DeleteKey('coolfile');
end;
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST + SHCNF_FLUSH, nil, nil);
Reg.Free;
end;
解决方案 »
- 为什么会是Cannot modify a read-only dataset
- 读取文本文件的问题,
- FastReport打印空行的问题(请各位指点)
- Delphi中如何将数据库Sql server中的数据库备份、如何恢复出来?
- delphi有什么函数可以浏览光盘?
- 如何通过内存分析其它进程中的控件类的构成
- 正则表达式匹配函数参数
- 怪问题:win98下编译的程序无法在win2000或win me下运行??
- 有没有办法自己释放自己, 比如一个button,当我点击button时, button 就free 掉, 不管用那种方法都可以,我现在急需解决类似的问题
- 怎样从4字节的integer变量中获取高字和低字?
- 我要拜Cobi(我是小新),不知道你愿意收吧?请尽快答复?[email protected] QQ:78615919
- delphide的dbgrid问题?
加上图标的语句是哪一句?
还有一个问题http://www.csdn.net/expert/topic/423/423871.shtm
我好崇拜你
我要拜你为师,我的QQ:5272432
[email protected]
收我为徒吧!