Shell.IsRestricted method

Retrieves a group's restriction setting from the registry.

Syntax

iRetVal = Shell.IsRestricted(
  sGroup,
  sRestriction
)

Shell.IsRestricted( _
  ByVal sGroup As BSTR, _
  ByVal sRestriction As BSTR _
) As Integer

Parameters

sGroup [in]

Type: BSTR

A String that contains the group name. This value is the name of a registry subkey under which to check for the restriction.

sRestriction [in]

Type: BSTR

A String that contains the restriction whose value is to be retrieved.

Return value

JScript

Type: Integer*

The value of the restriction. If the specified restriction is not found, the return value is 0.

VB

Type: Integer*

The value of the restriction. If the specified restriction is not found, the return value is 0.

Remarks

IsRestricted first looks for a subkey name that matches sGroup under the following key.

HKEY_LOCAL_MACHINE
   Software
      Microsoft
         Windows
            CurrentVersion
               Policies

Restrictions are declared as values of the individual policy subkeys. If the restriction named in sRestriction is found in the subkey named in sGroup, IsRestricted returns the restriction's current value. If the restriction is not found under HKEY_LOCAL_MACHINE, the same subkey is checked under HKEY_CURRENT_USER.

This method is not currently available in Microsoft Visual Basic.

Examples

The following examples show the use of IsRestricted to retrieve the data value of the undockwithoutlogon restriction from the System subkey. Usage is shown for JScript and VBScript.

JScript:

<script language="JScript">
    function fnIsRestricedJ()
    {
        var objShell = new ActiveXObject("shell.application");
        var lReturn;
        
        lReturn = objShell.IsRestricted("system", "undockwithoutlogon");
        document.write(lReturn);
    }
</script>

VBScript:

<script language="VBScript">
    function fnIsRestricedVB()
        dim objShell
        dim lReturn

        set objShell = CreateObject("shell.application")

        lReturn = objShell.IsRestricted("system", "undockwithoutlogon")
        document.write(lReturn)

        set objShell = nothing
    end function
</script>

Requirements

Requirement Value
Minimum supported client
Windows 2000 Professional, Windows XP [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
Header
Shldisp.h
IDL
Shldisp.idl
DLL
Shell32.dll (version 5.0 or later)