Home > Software engineering >  Control Panel Applet Execution Command Line Syntax
Control Panel Applet Execution Command Line Syntax

Time:09-18

I'm trying to invoke Internet Options Control Panel applet through command line (Run dialogue). Specifically, the "Connections" tab.

I used the following syntax:

rundll32.exe shell32.dll,Control_RunDLL INETCPL.CPL,,4

Which worked fine. My question is 2-fold:

  1. For the "Control_RunDLL" function, what is the 2nd parameter it takes?

(In my cases, and in all the documentation I found, it's NULL or empty)

(1st parameter being the applet name, and the 3rd being the tab number)

  1. Where can I access Microsoft documentation that specifically mentions the 2nd parameter?

CodePudding user response:

After digging around some more, turns out a .cpl (a control panel item)[1] file can contain multiple applets (of which enumeration starts from 0).

The 2nd parameter is for the applet index number within a .cpl file, then the 3rd parameter is for the tab index number within the specific applet (as mentioned in my question).

References:

[1] https://support.microsoft.com/en-us/topic/description-of-control-panel-cpl-files-4dc809cd-5063-6c6d-3bee-d3f18b2e0176

[2] https://www.walkernews.net/2007/06/06/quick-start-to-rundll32-syntax-and-example/

[3] https://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web WinBatch/Launching~WinBatch~and~Other~Apps/Control~Panel Running~Control~Panel~Applets.txt

[4] https://www2.isye.gatech.edu/~mgoetsch/cali/Windows Configuration/Windows Configuration Html/UsingRundll32toRunControlPanelApplets.htm

[5] https://docs.microsoft.com/en-us/windows/win32/api/shlobj/nf-shlobj-shruncontrolpanel

CodePudding user response:

Control_RunDLL is a private shell function, it is not documented. We still know its parameters because all rundll32 functions look like this:

void CALLBACK FunctionName(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow); 

This means it is something deeper inside shell32 that parses the command line parameters.

As you found out on your own, .cpl files can support more than one control panel "applet":

When Control Panel loads a .dll (or .cpl) file, it calls the CPlApplet function to get information such as the number of Control Panel items the file hosts, as well as information about each item.

Shell32 simply pretends to be the control panel when it "hosts" a .cpl file.

The 2nd parameter is known as the "The dialog box number" in the documentation and is represented by a icon in the classic/all control panel view. The 3rd parameter is parsed by the applet itself in response to CPL_STARTWPARMS and is often a name or number specifying a particular tab in a property sheet dialog.

The connections tab is documented as page 4 and the documented way to show it on Vista and later is

control.exe /name Microsoft.InternetOptions /page 4
  • Related