【发布时间】:2010-09-05 12:01:02
【问题描述】:
如何在 Windows 系统上创建自己的自定义名字对象(或 URL 协议)?
例子:
- http:
- 邮寄地址:
- 服务:
【问题讨论】:
如何在 Windows 系统上创建自己的自定义名字对象(或 URL 协议)?
例子:
【问题讨论】:
【讨论】:
这里有一些旧的 Delphi 代码,我们用它来获取 Web 应用程序中的快捷方式,以便在本地为用户启动 Windows 程序。
procedure InstallIntoRegistry;
var
Reg: TRegistry;
begin
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_CLASSES_ROOT;
if Reg.OpenKey('moniker', True) then
begin
Reg.WriteString('', 'URL:Name of moniker');
Reg.WriteString('URL Protocol', '');
Reg.WriteString('Source Filter', '{E436EBB6-524F-11CE-9F53-0020AF0BA770}');
Reg.WriteInteger('EditFlags', 2);
if Reg.OpenKey('shell\open\command', True) then
begin
Reg.WriteString('', '"' + ParamStr(0) + '" "%1"');
end;
end else begin
MessageBox(0, 'You do not have the necessary access rights to complete this installation!' + Chr(13) +
'Please make sure you are logged in with a user account with administrative rights!', 'Access denied', 0);
Exit;
end;
finally
FreeAndNil(Reg);
end;
MessageBox(0, 'Application WebStart has been installed successfully!', 'Installed', 0);
end;
【讨论】:
Inside OLE 可能对绰号有最好的报道。如果你想更深入地研究这个话题,我建议你买这本书。它也包含在随 VS 6.0 一起提供的 MSDN 磁盘中,以防您仍然拥有它。
【讨论】: