扩展名关联可执行文件,可执行文件打开文件
某扩展名关联某可执行文件,使用下面代码可以实现关联,
实现关联以后该扩展名的图标已改变,双击该文件,该可执行文件打开,如何实现可执行文件打开这个文件呢,当然打开文件是自己写的
function RegAssociatedExec(const AFileExt, AFileType, AFileDescription, AMIMEType, AIcon, AExecName: string): Boolean; stdcall;
begin
Result := False;
if (AFileExt = '') or (AExecName = '') then
Exit;
with TRegistry.Create do
begin
try
RootKey := HKEY_CLASSES_ROOT;
if not OpenKey(AFileExt, True) then
begin
Exit;
end;
WriteString('', AFileType);
if AMIMEType <> '' then
begin
WriteString('Content Type', AMIMEType);
end;
CloseKey;
if not OpenKey(AFileType, True) then
begin
Exit;
end;
WriteString('', AFileDescription);
CloseKey;
if AIcon <> '' then
begin
if not OpenKey(AFileType + '\DefaultIcon', True) then
begin
Exit;
end;
WriteString('', AIcon);
CloseKey;
end;
if not OpenKey(AFileType + '\Shell\Open\Command', True) then
begin
Exit;
end;
WriteString('', AExecName);
CloseKey;
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nil, nil);
finally
Free;
end;
end;
end;
实现关联以后该扩展名的图标已改变,双击该文件,该可执行文件打开,如何实现可执行文件打开这个文件呢,当然打开文件是自己写的
...全文
相关推荐
添加、编辑、删除操作在文件类型、属性和标记文件类型 图标 打开文件方式
用来查看与修改系统中已注册文件类型的小工具,可以可以添加、编辑和删除操作在文件类型、允许编辑属性和标记每个文件的类型、显示“文件类型”选项卡的“文件夹选项”窗口、显示所有注册文件扩展名和类型的列表。
RemoveAssocia删除关联扩展名
用于win7清除不需要的扩展名用 也可以清除关联错误的扩展名
文件扩展名大全
文件扩展名 有兴趣的可以了解下 我传的东西都是不要积分的 谢谢大家的支持
VC++根据文件后缀名获文件打开方式
例如输入.txt可以获取到关联的打开程序位notepad.exe,或者输入.avi可以获取打开avi视频文件的exe
文件扩展名的讲解说明.pdf
。。。


Windows SDK/API
