IShellDispatch4.ExplorerPolicy method

Gets the value for a specified Windows Internet Explorer policy.

Syntax

retVal = IShellDispatch4.ExplorerPolicy(
  bstrPolicyName
)

IShellDispatch4.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)