zoukankan      html  css  js  c++  java
  • 注册表文件关联

     1       #region 写入程序相关
    2 private void WriteApp()
    3 {
    4 //设置程序打开路径
    5 string path = "\"C:\\Users\\Administrator\\Desktop\\Test\\TestWinForm\\bin\\Debug\\TestWinForm.exe\"";
    6 RegistryKey root = Registry.ClassesRoot;
    7 RegistryKey f1 = root.CreateSubKey("Form1");
    8 //设置注册表程序打开的项与值,其中SetValue("", path)代表设置默认值
    9 f1.CreateSubKey("shell").CreateSubKey("Open").CreateSubKey("Command").SetValue("", path);
    10
    11 //设置程序图标
    12 string ico = "\"C:\\Users\\Administrator\\Desktop\\u7_original.ico\"";
    13 f1.CreateSubKey("DefaultIcon").SetValue("", ico);
    14 }
    15 #endregion
    16
    17 #region 写关联文件
    18 private void WriteRelate()
    19 {
    20 RegistryKey root = Registry.ClassesRoot;
    21 //设置打开程序
    22 root.CreateSubKey(".cws").CreateSubKey("OpenWithProgids").SetValue("Form1","");
    23 }
    24 #endregion
    code in my life.
  • 相关阅读:
    1619: 【例 1】Prime Distance
    Apache的架构师们遵循的30条设计原则(转帖)
    DP秒思维
    dsu on tree入门
    莫队入门
    行列式与霍尔基夫矩阵
    高精度板子
    splay入门
    回文自动机入门
    AC自动机
  • 原文地址:https://www.cnblogs.com/ghypnus/p/2433089.html
Copyright © 2011-2022 走看看