Exemplo n.º 1
0
        public ProgIdRegistration(string progId, CLSID clsId)
        {
            _progId = progId;
            string rootKeyName   = RegistrationUtil.ClassesRootKey.Name;
            string progIdKeyName = rootKeyName + @"\" + _progId;
            string value         = clsId.ToString("B").ToUpperInvariant();

            // Register the ProgId for CLSIDFromProgID.
            Logger.ComAddIn.Verbose("ProgIdRegistration - Set Value - {0} -> {1}", progIdKeyName, value);
            RegistrationUtil.SetValue(progIdKeyName + @"\CLSID", null, value, RegistryValueKind.String);
        }
Exemplo n.º 2
0
        public ComAddInRegistration(string progId, string friendlyName, string description)
        {
            // Register the ProgId as a COM Add-In in Excel.
            _progId     = progId;
            _subKeyName = WindowsIdentity.GetCurrent().User.ToString() + @"\Software\Microsoft\Office\Excel\Addins\" + progId;
            Logger.ComAddIn.Verbose("ComAddInRegistration - Creating User SubKey: " + _subKeyName);

            RegistryKey rk = RegistrationUtil.UsersCreateSubKey(_subKeyName, RegistryKeyPermissionCheck.ReadWriteSubTree);

            RegistrationUtil.KeySetValue(rk, "LoadBehavior", 0, RegistryValueKind.DWord);
            RegistrationUtil.KeySetValue(rk, "FriendlyName", friendlyName, RegistryValueKind.String);
            RegistrationUtil.KeySetValue(rk, "Description", description, RegistryValueKind.String);
        }
Exemplo n.º 3
0
        public ClsIdRegistration(CLSID clsId, string progId)
        {
            _clsId       = clsId;
            _clsIdString = clsId.ToString("B").ToUpperInvariant();
            string clsIdRootKeyName = RegistrationUtil.ClsIdRootKey.Name;
            string clsIdKeyName     = clsIdRootKeyName + "\\" + _clsIdString;

            // Register the CLSID

            // NOTE: Remember that all the CLSID keys are redirected under WOW64.
            Logger.ComAddIn.Verbose("ClsIdRegistration - Set Values - {0} ({1}) - {2}", clsIdKeyName, progId, DnaLibrary.XllPath);
            RegistrationUtil.SetValue(clsIdKeyName + @"\InProcServer32", null, DnaLibrary.XllPath, RegistryValueKind.String);
            RegistrationUtil.SetValue(clsIdKeyName + @"\InProcServer32", "ThreadingModel", "Both", RegistryValueKind.String);
            if (!string.IsNullOrEmpty(progId))
            {
                RegistrationUtil.SetValue(clsIdKeyName + @"\ProgID", null, progId, RegistryValueKind.String);
            }
        }
Exemplo n.º 4
0
 protected override void Deregister()
 {
     // Deregister the ProgId for CLSIDFromProgID.
     Logger.ComAddIn.Verbose("ClsIdRegistration - Delete SubKey {0}", RegistrationUtil.ClsIdRootKey.Name + _clsIdString);
     RegistrationUtil.DeleteSubKeyTree(RegistrationUtil.ClsIdRootKey, _clsIdString);
 }
Exemplo n.º 5
0
 protected override void Deregister()
 {
     // Deregister the ProgId for CLSIDFromProgID.
     Logger.ComAddIn.Verbose("ProgIdRegistration - Delete SubKey {0}", _progId);
     RegistrationUtil.DeleteSubKeyTree(RegistrationUtil.ClassesRootKey, _progId);
 }
Exemplo n.º 6
0
 protected override void Deregister()
 {
     // Remove Add-In registration from Excel
     Logger.ComAddIn.Verbose("ComAddInRegistration - Deleting User SubKey: " + _subKeyName);
     RegistrationUtil.UsersDeleteSubKey(_subKeyName);
 }