IShellDispatch.ControlPanelItem method

Runs the specified Control Panel application. If the application is already open, it will activate the running instance.

Note

As of Windows Vista, most Control Panel applications are Shell items and cannot be opened with this function. To open those Control Panel applications, pass the canonical name to control.exe. For example:

control.exe /name Microsoft.Personalization

 

Syntax

IShellDispatch.ControlPanelItem(
  bstrDir
)

IShellDispatch.ControlPanelItem( _
  ByVal bstrDir As BSTR _
)

Parameters

bstrDir [in]

Type: BSTR

The Control Panel application's file name.

Return value

JScript

This method does not return a value.

VB

This method does not return a value.

Remarks

This method is implemented and accessed through the Shell.ControlPanelItem method.

Examples

The following examples use ControlPanelItem to run the Control Panel's Display Properties item. Usage is shown for JScript, VBScript, and Visual Basic.

JScript:

<script language="JScript">
    function fnShellControlPanelItemJ()
    {
        var objShell = new ActiveXObject("shell.application");
        
        objshell.Shell_ControlPanelItem("desk.cpl");
    }
</script>

VBScript:

<script language="VBScript">
    function fnShellControlPanelItemVB()
        dim objShell
        
        set objShell = CreateObject("shell.application")
        objshell.Shell_ControlPanelItem("desk.cpl")
       
        set objShell = nothing
    end function
 </script>

Visual Basic:

Private Sub fnShellControlPanelItemVB()
    Dim objShell As Shell
    
    Set objShell = New Shell
    objshell.Shell_ControlPanelItem ("desk.cpl")
    
    Set objShell = Nothing
End Sub

Requirements

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