How do you create your own moniker (URL Protocol) on Windows systems?
Asked Answered
W

3

13

How do you create your own custom moniker (or URL Protocol) on Windows systems?

Examples:

  • http:
  • mailto:
  • service:
Wheatley answered 7/8, 2008 at 12:31 Comment(1)
Windows? COM/OLE moniker (almost) predates the Internet. http protocol handler is not com moniker. Example of a com moniker is "new:". Will that work in e.g. Win11? I am pretty sure it will.Alexina
K
4

Take a look at Creating and Using URL Monikers , About Asynchronous Pluggable Protocols and Registering an Application to a URL Protocol from MSDN

Kerouac answered 7/8, 2008 at 12:42 Comment(1)
Your Registering Link had the details I had in mind. @Lasse's answer also contained the details.Wheatley
R
3

Here's some old Delphi code we used as a way to get shortcuts in a web application to start a windows program locally for the user.

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;
Ralph answered 7/8, 2008 at 12:52 Comment(0)
T
0

Inside OLE from Craig Brockschmidt probably has the best coverage on monikers. If you want to dig a little deeper into this topic, I'd recommend getting this book. It is also contained on the MSDN disk that came along with VS 6.0, in case you still have that.

Trackman answered 2/9, 2008 at 6:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.