コード例 #1
0
        private static void RegisterForActivation()
        {
            // Register one or more supported filetypes,
            // an icon (specified by binary file path plus resource index),
            // a display name to use in Shell and Settings,
            // zero or more verbs for the File Explorer context menu,
            // and the path to the EXE to register for activation.
            string[] myFileTypes = { ".foo", ".foo2", ".foo3" };
            string[] verbs       = { "view", "edit" };
            ActivationRegistrationManager.RegisterForFileTypeActivation(
                myFileTypes,
                executablePathAndIconIndex,
                "Contoso File Types",
                verbs,
                executablePath
                );

            // Register a URI scheme for protocol activation,
            // specifying the scheme name, icon, display name and EXE path.
            ActivationRegistrationManager.RegisterForProtocolActivation(
                "foo",
                executablePathAndIconIndex,
                "Contoso Foo Protocol",
                executablePath
                );

            // Register for startup activation.
            ActivationRegistrationManager.RegisterForStartupActivation(
                "ContosoStartupId",
                executablePath
                );

            OutputMessage("Registered for rich activation");
        }
コード例 #2
0
 public static void RegisterForFileActivation()
 {
     // Register one or more supported filetypes,
     // an icon (specified by binary file path plus resource index),
     // a display name to use in Shell and Settings,
     // zero or more verbs for the File Explorer context menu,
     // and the path to the EXE to register for activation.
     string[] myFileTypes = { ".moo" };
     string[] verbs       = { "view", "edit" };
     ActivationRegistrationManager.RegisterForFileTypeActivation(
         myFileTypes,
         executablePathAndIconIndex,
         "Contoso File Types",
         verbs,
         executablePath
         );
 }