SHRunControlPanel function (shlobj.h)

Opens a Control Panel item.

Note  This function is not supported as of Windows Vista
 

Syntax

BOOL SHRunControlPanel(
  [in]           PCWSTR lpcszCmdLine,
  [in, optional] HWND   hwndMsgParent
);

Parameters

[in] lpcszCmdLine

Type: PCWSTR

Pointer to a string that contains the command line that opens the Control Panel item. This command line includes at least the name of the .cpl file. It can also contain any other necessary information such as the property sheet page within the item (either by ordinal or by name). For more information, see Executing Control Panel Items.

[in, optional] hwndMsgParent

Type: HWND

The handle of the parent window, used to display error messages about the opening of the item. This value can be NULL.

Return value

Type: BOOL

TRUE if the Control Panel item was opened successfully; otherwise, FALSE.

As of Windows Vista, this function always returns FALSE.

Remarks

If the specified Control Panel item is already running, SHRunControlPanel attempts to switch to that instance rather than opening a new instance.

Examples

Example calls to SHRunControlPanel are shown here.

SHRunControlPanel(TEXT("timedate.cpl"), hwnd);
SHRunControlPanel(L"appwiz.cpl", NULL);
SHRunControlPanel(L"appwiz.cpl,2", NULL);
SHRunControlPanel("desk.cpl,Settings", hwnd

Requirements

Requirement Value
Minimum supported client Windows XP with SP1 [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header shlobj.h
DLL Shell32.dll