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

  • 相关阅读:
    基于MFC的Media Player播放器的制作(1---播放器界面的布局)
    Codeforces 1182
    Codeforces 1169
    Codeforces 1167
    Codeforces 1166
    Codeforces 1148
    *Codeforces 1162
    Codeforces 1159
    点分治
    高斯消元*
  • 原文地址:https://www.cnblogs.com/kongll/p/2555717.html
Copyright © 2011-2022 走看看