通过url访问桌面应用程序

时间:2018-06-07 07:27:50

标签: c# activex

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

1 个答案:

答案 0 :(得分:1)

要通过网址访问应用,您必须为特定网址注册您的应用,如下所示:

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");
}

度过愉快的一天