我们如何在Windows系统上创建自己的绰号(URL协议)?
时间:2020-03-05 18:38:19 来源:igfitidea点击:
我们如何在Windows系统上创建自己的自定义绰号(或者URL协议)?
例子:
- http:
- mailto:
- 服务:
解决方案
回答
看一下创建和使用URL Monikers,关于异步可插入协议以及从MSDN将应用程序注册到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;
回答
来自Craig Brockschmidt的OLE内部可能对绰号具有最佳覆盖。如果我们想更深入地研究该主题,建议我们阅读本书。如果我们仍然拥有VS 6.0,它也包含在VS 6.0随附的MSDN磁盘上。