zoukankan      html  css  js  c++  java
  • c#创建文件关联

    try
                    {
                        string MyFileName = AppSetter.SysInfoPath + @"\DrawTools\csg.exe";
                        string MyExtName = ".csg";
                        string MyType = "csgfile";
                        RegistryKey key = Registry.ClassesRoot.OpenSubKey(MyExtName);
                        if (key == null || key.ValueCount == 0)
                        {
                            RegistryKey MyReg = Registry.ClassesRoot.CreateSubKey(MyExtName);
                            MyReg.SetValue("", MyType);
                            MyReg = MyReg.CreateSubKey("shell\\open\\command");
                            MyReg.SetValue("", MyFileName + " %1");
                            MyReg.Close();
                        }
                        else if (!key.GetValue("").ToString().Equals(MyType))
                        {
                            key.DeleteSubKeyTree(MyExtName);
                            RegistryKey MyReg = Registry.ClassesRoot.CreateSubKey(MyExtName);
                            MyReg.SetValue("", MyType);
                            MyReg = MyReg.CreateSubKey("shell\\open\\command");
                            MyReg.SetValue("", MyFileName + " %1");
                            MyReg.Close();
                        }
                    }
                    catch (Exception ex)
                    {
                        Tools.Trace("Program:Main error:" + ex.ToString());
                    }

  • 相关阅读:
    凹透镜
    三角形动点和将军饮马
    数学
    壮壮学习准则
    均值不等式,求极值
    2020年自贡中考数学真题,用的是花钱买的"几何画板",wechat:QZCS12
    90年高考题
    裂项:2005年初中数学竞赛题p32,4
    02-需求来源
    01-产品需求的内涵
  • 原文地址:https://www.cnblogs.com/kongll/p/2555717.html
Copyright © 2011-2022 走看看