Open a Control Panel dialog or wizard

Open a Control Panel dialog or wizard

Have you ever needed to open a Windows dialog such as Internet Properties, New Hardware, Modem Properties or any other dialog you can find in the Control Panel? Well, it’s very simple, onve you know the trick.

All these dialogs are implemented in files with the CPL extension. (They’re actually DLLs with their extension changed.) All you have to do is call the appropriate function in these DLLs. Windows provides an application called “rundll32.exe” – located in Windows main directory – that allows you to do that. For example, to open the Mouse Properties dialog you should write this line in the Run dialog:

rundll32.exe shell32.dll,Control_RunDLL main.cpl @0

If you know the correct syntax, you can open these dialogs from your applications as well. here is a routine that can open most of the Control Panel dialogs. It takes a value specified in a Enum list and uses it to determine the correct string to pass to “rundll32.exe”, then passes the full commnad line to the Shell function:

Public Enum mbDialogType    mbNewHardware    mbAddRemove    mbDateTimeProp    mbDisplayProp    mbInternetProp    mbGameProp    mbKeyboardProp    mbModemProp    mbMouseProp    mbMultimediaProp    mbNetworkProp    mbPasswordProp    mbInternationalProp    mbSoundProp    mbSystemPropEnd Enum         Sub OpenWindowsDialog(ByVal mbDialog As mbDialogType)    Dim s As String    Select Case mbDialog        Case mbNewHardware: s = "sysdm.cpl @1"        Case mbAddRemove: s = "appwiz.cpl,,1"        Case mbDateTimeProp: s = "timedate.cpl"        Case mbDisplayProp: s = "desk.cpl,,0"        Case mbInternetProp: s = "inetcpl.cpl,,0"        Case mbGameProp: s = "joy.cpl"        Case mbKeyboardProp: s = "main.cpl @1"        Case mbModemProp: s = "modem.cpl"        Case mbMouseProp: s = "main.cpl @0"        Case mbMultimediaProp: s = "mmsys.cpl,,0"        Case mbNetworkProp: s = "netcpl.cpl"        Case mbPasswordProp: s = "password.cpl"        Case mbInternationalProp: s = "intl.cpl,,0"        Case mbSoundProp: s = "mmsys.cpl @1"        Case mbSystemProp: s = "sysdm.cpl,,0"    End Select    Shell "rundll32.exe shell32.dll,Control_RunDLL " & s, 5End Sub

See also  Does It Make Sense to Splurge on a Laptop?

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist