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

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS