Shelling Control Panel Applets and System Wizards


Name: Shelling Control Panel Applets and System Wizards
Author: Karl Peterson
Date: August 12, 1998
Level: All
Credits: Thanks go out to Karl Peterson for allowing me to reprint this useful information. You can find this and other items on his excellent One Stop Source Shop web site.

Shelling Control Panel Applets and System Wizards

An infrequent but recurring question in online discussion groups goes along the lines of, "How do I call up the Control Panel time/date (substitute wallpaper, mouse, whatever) dialog from VB?" Frequently this is accompanied with wonder about how to force the VB app to wait until the user makes their desired choices and dismisses the dialog. Listed below are all the codes required to call most of the Control Panel applets. I've collected these over the years from various online postings, but since new applets are always being added would appreciate hearing of any you could contribute to grow the list!

Check it out:
 

Use the following snippet to Shell the date/time dialog.
Substitute the codes below for other Control Panel dialogs.
   Option Explicit
   
   Private Sub SetDateTime()
      Call Shell("rundll32.exe shell32.dll,Control_RunDLL timedate.cpl")
   End Sub
Couldn't be much easier, could it? The only trick is knowing the "secret code" for each dialog. Now, while the above will bring up the date/time dialog, your VB app will have no way of knowing when that dialog has been dismissed. For the answer to that, go to my Samples page and download Shell32.zip which shows several methods you can use to "shell and wait."

So, what are the secret codes? Here ya go...

Control Panel (CONTROL.EXE)

Control Panel:
    rundll32.exe shell32.dll,Control_RunDLL

Accessability Settings (ACCESS.CPL)

Accessability Properties (Keyboard):
    rundll32.exe shell32.dll,Control_RunDLL access.cpl,,1
Accessability Properties (Sound):
    rundll32.exe shell32.dll,Control_RunDLL access.cpl,,2
Accessability Properties (Display):
    rundll32.exe shell32.dll,Control_RunDLL access.cpl,,3
Accessability Properties (Mouse):
    rundll32.exe shell32.dll,Control_RunDLL access.cpl,,4
Accessability Properties (General):
    rundll32.exe shell32.dll,Control_RunDLL access.cpl,,5

Add/Remove Programs (APPWIZ.CPL)

Add/Remove Programs Properties (Install/Uninstall):
    rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl,,1
Add/Remove Programs Properties (Windows Setup):
    rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl,,2
Add/Remove Programs Properties (Startup Disk):
    rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl,,3

Display Settings (DESK.CPL)

Display Properties (Background):
    rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,0
Display Properties (Screen Saver):
    rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,1
Display Properties (Appearance):
    rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,2
Display Properties (Settings):
    rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,3

Display Properties (Install Screen Saver):
    rundll32.exe desk.cpl,InstallScreenSaver %1
    (opens .scr at location specified by %1 in preview window)

FindFast Settings (FINDFAST.CPL)

Find Fast Properties (General):
    rundll32.exe shell32.dll,Control_RunDLL findfast.cpl

Internet Settings (INETCPL.CPL)

Internet Properties (General):
    rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,0
Internet Properties (Security):
    rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,1
Internet Properties (Content):
    rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,2
Internet Properties (Connection):
    rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,3
Internet Properties (Programs):
    rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,4
Internet Properties (Advanced):
    rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,5

Regional Settings (INTL.CPL)

Regional Settings Properties (Regional Settings):
    rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,0
Regional Settings Properties (Number):
    rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,1
Regional Settings Properties (Currency):
    rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,2
Regional Settings Properties (Time):
    rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,3
Regional Settings Properties (Date):
    rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,4
Regional Settings Properties (Input Locales):
    rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,5

Joystick Settings (JOY.CPL)

Joystick Properties (Joystick):
    rundll32.exe shell32.dll,Control_RunDLL joy.cpl

Mouse/Keyboard/Printers/Fonts Settings (MAIN.CPL)

Mouse Properties:
    rundll32.exe shell32.dll,Control_RunDLL main.cpl @0
Keyboard Properties:
    rundll32.exe shell32.dll,Control_RunDLL main.cpl @1
Printers:
    rundll32.exe shell32.dll,Control_RunDLL main.cpl @2
Fonts:
    rundll32.exe shell32.dll,Control_RunDLL main.cpl @3

Mail and Fax Settings (MLCFG32.CPL)

Microsoft Exchange/Outlook Properties (General):
    rundll32.exe shell32.dll,Control_RunDLL mlcfg32.cpl

Multimedia/Sounds Settings (MMSYS.CPL)

Multimedia Properties (Audio):
    rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,0
Multimedia Properties (Video):
    rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,1
Multimedia Properties (MIDI):
    rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,2
Multimedia Properties (CD Music):
    rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,3
Multimedia Properties (Advanced/Devices):
    rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,4

Sounds Properties:
    rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl @1

Modem Settings (MODEM.CPL)

Modem Properties (General):
    rundll32.exe shell32.dll,Control_RunDLL modem.cpl

Network Settings (NETCPL.CPL / NCPA.DLL)

Network (Configuration):
    Win9x: rundll32.exe shell32.dll,Control_RunDLL netcpl.cpl
    WinNT: rundll32.exe shell32.dll,Control_RunDLL ncpa.cpl

Dial-up Networking Wizard
    Win9x: rundll32.exe rnaui.dll,RnaWizard

Create Share Dialog
    WinNT: rundll32.exe ntlanui.dll,ShareCreate
Manage Shares Dialog
    WinNT: rundll32.exe ntlanui.dll,ShareManage

ODBC Settings (ODBCCP32.CPL)

ODBC Data Source Administrator (General):
    rundll32.exe shell32.dll,Control_RunDLL odbccp32.cpl

Password Settings (PASSWORD.CPL)

Password Properties (Change Passwords):
    Win9x: rundll32.exe shell32.dll,Control_RunDLL password.cpl

COM Ports Settings (PORTS.CPL)

COM Ports Properties (General):
    WinNT: rundll32.exe shell32.dll,Control_RunDLL ports.cpl

Server Properties (SRVMGR.CPL)

Server Properties (General):
    WinNT: rundll32.exe shell32.dll,Control_RunDLL srvmgr.cpl

System Settings (SYSDM.CPL)

System Properties (General):
    rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,0
System Properties (Device Manager):
    Win9x: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,1
System Properties (Performance):
    Win9x: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,3
    WinNT: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,1
System Properties (Environment):
    WinNT: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,2
System Properties (Startup/Shutdown):
    WinNT: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,3
System Properties (Hardware Profiles):
    Win95: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,2
    WinNT: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,4
System Properties (User Profiles):
    WinNT: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,5

Add New Hardware Wizard:
    Win9x: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl @1
Add New Printer Wizard:
    Win9x: rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL AddPrinter

Telephony Settings (TELEPHON.CPL)

Dialing Properties (My Location / Drivers):
    WinNT: rundll32.exe shell32.dll,Control_RunDLL telephon.cpl

Themes Settings (THEMES.CPL)

Themes Properties (General):
    rundll32.exe shell32.dll,Control_RunDLL themes.cpl

Time and Date Settings (TIMEDATE.CPL)

Date/Time Properties:
    rundll32.exe shell32.dll,Control_RunDLL timedate.cpl
Choose Time Zone:
    rundll32.exe shell32.dll,Control_RunDLL timedate.cpl,,/f

TweakUI Settings (TWEAKUI.CPL)

TweakUI Dialog (General):
    rundll32.exe shell32.dll,Control_RunDLL tweakui.cpl

UPS Settings (UPS.CPL)

Uninteruptable Power Supply Properties (General):
    WinNT: rundll32.exe shell32.dll,Control_RunDLL ups.cpl

Microsoft Mail Postoffice Settings (WGPOCPL.CPL)

Microsoft Workgroup Postoffice Admin:
    rundll32.exe shell32.dll,Control_RunDLL wgpocpl.cpl

Miscellaneous File System Dialogs and Wizards

Open With (File Associations):
    rundll32.exe shell32.dll,OpenAs_RunDLL d:\path\filename.ext
Run Diskcopy Dialog:
    rundll32 diskcopy.dll,DiskCopyRunDll
Create New Shortcut Wizard:
    rundll32.exe AppWiz.Cpl,NewLinkHere %1
    (creates shortcut at location specified by %1)
Create a Briefcase:
    rundll32.exe syncui.dll,Briefcase_Create
View Fonts:
    rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL FontsFolder
View Printers:
    rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL PrintersFolder

I've also posted a text version of this information which you may find handy (you can find shellcpl.txt on Karl's site).

Again, please send me an e-mail if you find any additional codes that I could add to this list!


Copyright ©1995-98, Karl E. Peterson, All Rights Reserved Worldwide