Help & Manual authoring tool
The API ShellExecute can be used to programmatically open the Control Panel window or run a Control Panel applet, and you can even specify the initially displayed tabsheet of a CP applet

Showing the Control Panel window or running a Control Panel applet

Copyright © 2000 Ernesto De Spirito

KnowledgeBase Vortex 2.9

Showing the Control Panel window

To show the control panel window programmatically you have to run the rundll32.exe application (located in the Windows directory) passing it shell32.dll,Control_RunDLL as the parameter, as you can see in the following source code example:

uses ShellAPI;

...

ShellExecute(Form1.Handle, nil, 'rundll32.exe',
  'shell32.dll,Control_RunDLL', nil, SW_SHOW);

Opening a Control Panel applet

To open an applet is almost the same as opening the Control Panel, but you have to add the name of the applet file as an extra parameter (these files are located in the System directory and have a .cpl extension). The following example would open the Multimedia applet by code:

ShellExecute(Form1.Handle, nil, 'rundll32.exe',
  'shell32.dll,Control_RunDLL mmsys.cpl', nil, SW_SHOW);
You can specify the tab initially shown in the applet window. The following example would open the Multimedia applet initially showing the Video tab (numbers start from 0 and Video is the second tab so it's number is 1):

ShellExecute(Form1.Handle, nil, 'rundll32.exe',
  'shell32.dll,Control_RunDLL mmsys.cpl,,1', nil, SW_SHOW);
JfControls Library - for Delphi and C++ Builder
Copyright © 2000/2006 Ernesto De Spirito.   All rights reserved.