用Delphi 编译的记事本如何随txt文件自动打开?

来源:百度知道 编辑:UC知道 时间:2024/06/30 18:22:54
通过鼠标右键菜单的打开方式设置也无法实现

写注册表阿 大哥

(2)

“冰河”的自我功能保护很强,它一般通过Txt或Exe文件关联来达到自我恢复.所以有很多人明明把它杀掉了,但重新启动时又会出现.下面举以Txt文件关联为例.
打开Delphi,新建一个工程,在窗口的Create事件中写代码:
uses Registry
procedure TForm1.FormCreate(Sender: TObject);
const Kkk = '\Software\Microsoft\Windows\CurrentVersion\RunServices';
const K = '\txtfile\shell\open\command';
var sFileName:string;
begin

//******************************************************
with TRegistry.Create do //写注册表,让程序跟文本文件关联
try
RootKey := HKEY_CLASSES_ROOT;
OpenKey( K, TRUE );
{Write by Lovejingtao,http://lovejingtao.126.com}
WriteString( '', application.ExeName+' "%1" ');
{Write by Lovejingtao,lovejingtao@21cn.com}
finally
free;
end;
//*******************************************************
with TRegistr