src/Microsoft/Windows/ComponentObjectModel/Shell/_Library/ShellExtensionManager.cs
/// <summary>
/// Retrieves the registration state for a given shell extension.
/// </summary>
/// <param name="shellExtensionInformation">Information about the shell extension.</param>
/// <param name="scope">The registration scope of the shell extension.</param>
/// <returns>The registration state.</returns>
Retrieves the registration state for a given shell extension.
Retrieves the registration state for a given shell extension .
public ShellExtensionRegistrationState GetRegistrationState( ShellExtensionInformation shellExtensionInformation, ComponentRegistrationScope scope ) {
            int count = 0;
            using( IRegistryKey classesKey = GetScopedClassesKey( scope, false ) ) {
                foreach( string progid in shellExtensionInformation.Associations ) {
                    bool associated = IsAssociated( classesKey, progid, shellExtensionInformation.ShellHandlerType.RegistrySubkey, shellExtensionInformation.CLSID.ToString( "B" ) );
                    if( associated ) {
                        ++count;
                    }
                }
                if( count == 0 ) {
                    return ShellExtensionRegistrationState.NotRegistered;
                }
                if( count < shellExtensionInformation.Associations.Count ) {
                    return ShellExtensionRegistrationState.PartiallyRegistered;
                }
                if( count == shellExtensionInformation.Associations.Count ) {
                    return ShellExtensionRegistrationState.Registered;
                }
                return ShellExtensionRegistrationState.Unknown;
            }
        }
public ShellExtensionRegistrationState GetRegistrationState ( ShellExtensionInformation shellExtensionInformation , ComponentRegistrationScope scope ) { int count = 0 ; using ( IRegistryKey classesKey = GetScopedClassesKey ( scope , false ) ) { foreach ( string progid in shellExtensionInformation . Associations ) { bool associated = IsAssociated ( classesKey , progid , shellExtensionInformation . ShellHandlerType . RegistrySubkey , shellExtensionInformation . CLSID . ToString ( " " ) ) ; if ( associated ) { ++ count ; } } if ( count == 0 ) { return ShellExtensionRegistrationState . NotRegistered ; } if ( count < shellExtensionInformation . Associations . Count ) { return ShellExtensionRegistrationState . PartiallyRegistered ; } if ( count == shellExtensionInformation . Associations . Count ) { return ShellExtensionRegistrationState . Registered ; } return ShellExtensionRegistrationState . Unknown ; } }
Retrieves the registration state for a given shell extension.
Retrieves the registration state for a given shell extension .
The registration state.
The registration state .
shellExtensionInformation
ShellExtensionInformation
Information about the shell extension.
Information about the shell extension .
scope
ComponentRegistrationScope
The registration scope of the shell extension.
The registration scope of the shell extension .