Start Control Panel Applets Using Rundll32.Exe

The Windows Rundll32 command line utility allows you to run a 32-bit function exported from a DLL. However, you cannot call any exported function from any DLL. For example, you cannot call Win32 APIs exported from system DLLs such as Kernel32.dll. Rundll32 only allows you to call functions from a DLL that are explicitly written to be called by Rundll32.

So what can you call? The Rundll32.exe utility allows you perform tasks such as starting Control Panel applets, launching Dial Up Networking (DUN), formatting a floppy disk from your Visual Basic program, de-branding Internet Explorer,...

This page shows how to use Rundll32. However, you can also open Control Panel, Dial Up Networking, My Computer, the Printers and Network Neighborhood folders and more by shelling out to Explorer. The attached Explorer.txt file shows how to do that as well.

Using Rundll32 to Start Control Panel Applets and Dial Up Networking
Download Source Code

Syntax
   Rundll32.exe <dllname>,<entrypoint> <optional arguments>

Always specify the full path to the dll and use the short name convention. You can use my Convert Long Path Names to Short (8 Character) Names program to convert a long path the the 8-character short path equivalent.

Exact syntax is critical as is the case of the dll and function being called. There should be no white space between <dllname> and the comma or the comma and <entrypoint>. If Rundll32 fails, it will most likely do so without providing any error information.

Launching Control Panel Applets

Call Rundll32 as:

   Rundll32.exe shell32.dll,Control_RunDLL <cpl app>,<applet>,<page>

Where:

Control_RunDLL

Case Sensitive.

<cpl app>

Name of Control Panel applet to open.

<applet>

If the applet contains multiple applets, such as the printer applet, this indicates which one to open. Numbering is zero-based preceded with "@".

<page>

The one-based page or Tab within the applet to display.

Names of some common Control Panel applets:

Name

Description

AppWiz.cpl

Add/Remove Programs

Desk.cpl

Display Properties

Inetcpl.cpl

Internet Properties

Intl.cpl

Regional Settings Properties

Joy.cpl

Joystick

Main.cpl

Mouse Properties

Mmsys.cpl

Multimedia Properties

Modem.cpl

Modem Properties

Odbccp32.cpl

32 bit ODBC Data Source Administrator

Password.cpl

Password Properties

Sysdm.cpl

System Properties

Themes.cpl

Desktop Themes

Timedate.cpl

Date/Time Properties

Wgpocpl.cpl

MS Workgroup Post Office

Netcpl.cpl

Network Properties

Launching Dial Up Networking

Call Rundll32 as:

   Shell("Rundll32.exe rnaui.dll,RnaDial " & sDialUpName, vbNormalFocus)

Where:
        sDialUpName - Name of you Dial Up Networking connection as it appears in the
        Dial Up Networking Control Panel applet.

Note: You can also dial your default internet connection using my Open/Print Files, View Web Sites, Connect to the Internet program.

Formatting a Floppy

Call Rundll32 as:

   Shell ("Rundll32.exe shell32.dll,SHFormatDrive")

De-Branding Internet Explorer

Call Rundll32 as:

   Shell ("Rundll32.exe iedkcs32.dll,Clear")

You can also click the Start Menu, click Run and type in "rundll32 iedkcs32.dll,Clear" without the quotes then hit Enter.

Instructions

Download the source program. Press F5 to run it. Click the desired option then click the Start Applet button.




About TheScarms
About TheScarms


Sample code
version info

If you use this code, please mention "www.TheScarms.com"

Email this page


© Copyright 2024 TheScarms
Goto top of page