SHRunControlPanel function

Opens a Control Panel item.

Note  This function is not supported as of Windows Vista


BOOL SHRunControlPanel(
  PCWSTR lpcszCmdLine,
  HWND   hwndMsgParent




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.


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.


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


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


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