Shell.ExplorerPolicy method

Gets the value for a specified Windows Internet Explorer policy.

Syntax

retVal = Shell.ExplorerPolicy(
  bstrPolicyName
)

Shell.ExplorerPolicy( _
  ByVal bstrPolicyName As BSTR _
) As Variant

Parameters

bstrPolicyName [in]

Type: BSTR

A String that specifies the name of the policy.

Return value

JScript

Type: Variant*

The value associated with the specified policy name.

VB

Type: Variant*

The value associated with the specified policy name.

Remarks

Network Administrators can control and manage the computing environment of their users by setting policies.

The specified value name must be within the HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer subkey. If the value name does not exist then the method returns null.

Examples

The following examples show the proper use of ExplorerPolicy for JScript, VBScript, and Visual Basic.

JScript:

<script language="JScript">
    function fnIShellDispatch4ExplorerPolicyJ()
    {
        var objShell = new ActiveXObject("shell.application");
        var vReturn;
        
        vReturn = objShell.ExplorerPolicy("ValueName");
        alert(vReturn);
    }
</script>

VBScript:

<script language="VBScript">
     function fnIShellDispatch4ExplorerPolicyVB()
        dim objShell
        dim vReturn
        
        set objShell = CreateObject("shell.application")
            vReturn = objShell.ExplorerPolicy("ValueName")
            alert(vReturn)
        set objShell = nothing
    end function
 </script>

Visual Basic:

Private Sub fnIShellDispatch4ExplorerPolicyVB()
    Dim objShell As Shell
    Dim vReturn  As Variant
    
    Set objShell = New Shell
        vReturn = objShell.ExplorerPolicy("ValueName")
        Debug.Print vReturn
    Set objShell = Nothing
End Sub

Requirements

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