반응형
      public void SetAssociationIcon(string fileExtention, string progid, string iconFullPath)
        {
            try
            {
 
                    fileExtention = "." + fileExtention;
                    Registry.ClassesRoot.CreateSubKey(fileExtention).SetValue("", progid);
                    Registry.ClassesRoot.CreateSubKey(progid).CreateSubKey("DefaultIcon").SetValue("", iconFullPath);
                    IsNeedRefresh = true;
                 
 
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 
       public void SetAssociationExe(string progid, string excuteProgramFullPath)
        {
            try
            {
                excuteProgramFullPath = excuteProgramFullPath + " \"%1\"";
 
 
                    Registry.ClassesRoot.CreateSubKey(progid).CreateSubKey("shell")
                                                            .CreateSubKey("open")
                                                            .CreateSubKey("command")
                                                            .SetValue("", excuteProgramFullPath);
                 
            }
 
            catch (Exception ex)
            {
                throw ex;
            }
        }

+ Recent posts