views:

450

answers:

2

How do I open a custom control panel programmatically, like custom.cpl? Specifically, how do I open a 64-bit cpl when running as 32-bit application?

+4  A: 

Since I didn't find a good answer here on SO, here's the solution of my research:

  • Start a new application "control" that gets the name of the control panel as its first parameter:
::ShellExecute(m_hWnd, NULL, _T("control.exe"), _T("access.cpl"), NULL, SW_SHOW);
vividos
+2  A: 

Vista added support for canonical names so you don't have to hard code dll filenames and tab indexs

Example: WinExec("%systemroot%\system32\control.exe /name Microsoft.WindowsUpdate", SW_NORMAL);

(Names are always in english)

See MSDN for a list

XP/2000 supports "control.exe mouse" and a few other keywords, see the same MSDN page for a list (You can probably find some undocumented ones by running strings on control.exe)

Anders