How to programmatically open control panel?

vividos picture vividos · Feb 2, 2009 · Viewed 9.3k times · Source

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?

Answer

vividos picture vividos · Feb 2, 2009

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);