通过 url 访问桌面应用程序

Accessing desktop application through url

通过URL访问桌面应用程序(软件)?我想使用 visual studio 创建一个简单的应用程序来创建 active x ,如下所示: https://blogs.msdn.microsoft.com/asiatech/2011/12/05/how-to-develop-and-deploy-activex-control-in-c/

要通过 url 访问应用程序,您必须像这样为特定的 URL 注册您的应用程序:

public void RegisterURLProtocol(string protocolName, string applicationPath, string description)
{
    // Create new Key for URL Protocol
    RegistryKey myKey=Registry.ClassesRoot.CreateSubKey(protocolName);

    // Assign Protocol
    myKey.SetValue(null, description);
    myKey.SetValue("URL Protocol", string.Empty);

    // Assign Shell Values
    Registry.ClassesRoot.CreateSubKey(protocolName + "\Shell");
    Registry.ClassesRoot.CreateSubKey(protocolName + "\Shell\open");
    myKey = Registry.ClassesRoot.CreateSubKey(protocolName + "\Shell\open\command");

    // Determine App who's receiving the URL calls with params
    myKey.SetValue(null, "\"" + applicationPath,  + "\" %1");
}

祝你有愉快的一天