如何在 Windows 系统上创建自己的自定义名称(或 URL 协议)?

例子:

  • http:
  • 邮寄地址:
  • 服务:
有帮助吗?

其他提示

下面是一些旧的 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;

内部 OLE 克雷格·布罗克施密特 (Craig Brockschmidt) 的作品可能对绰号有最好的报道。如果您想更深入地研究这个主题,我建议您阅读这本书。它也包含在随 VS 6.0 一起提供的 MSDN 磁盘中,以防万一您还拥有该磁盘。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top