Exemple #1
0
        public static void WriteRelate(string Name, string APPkey)
        {
            RegistryKey root = Registry.ClassesRoot;

            //设置打开程序
            root.CreateSubKey(Name).SetValue("", APPkey);
            //刷新桌面
            ToolKit.SHChangeNotify(0x8000000, 0, IntPtr.Zero, IntPtr.Zero);
        }
Exemple #2
0
        public static void DelRelate(string Name)
        {
            RegistryKey root = Registry.ClassesRoot;

            if (root.OpenSubKey(Name) != null)
            {
                root.DeleteSubKeyTree(Name);
            }

            //刷新桌面
            ToolKit.SHChangeNotify(0x8000000, 0, IntPtr.Zero, IntPtr.Zero);
        }
Exemple #3
0
        public static void WriteApp(string Path, string IcoPath, string APPkey)
        {
            //设置程序打开路径
            string      path = "\"" + Path + "\"" + "\"%1\"";
            RegistryKey root = Registry.ClassesRoot;
            RegistryKey f1   = root.CreateSubKey(APPkey);

            //设置注册表程序打开的项与值,其中SetValue("", path)代表设置默认值
            f1.CreateSubKey("shell").CreateSubKey("Open").CreateSubKey("Command").SetValue("", path);

            //设置程序图标
            string ico = "\"" + IcoPath + "\"";

            f1.CreateSubKey("DefaultIcon").SetValue("", ico);
            //刷新桌面
            ToolKit.SHChangeNotify(0x8000000, 0, IntPtr.Zero, IntPtr.Zero);
        }