HOWTO: Starting a Control Panel Applet in Windows 95 or WinNT

Last reviewed: January 9, 1998
Article ID: Q135068
The information in this article applies to:
  • Microsoft Win32 Application Programming Interface (API) included with: - Microsoft Windows 95 version 4.0 - Microsoft Windows NT version 4.0

SUMMARY

In Windows 95 and Windows NT 4.0, the Control Panel application (Control.exe) is just a stub that calls into the shell to start the Control Panel. To debug a control panel applet, you need to invoke the Control Panel as the calling application. However, Control.exe is just a stub, so the debugger cannot load it. To invoke a control panel applet in Windows 95 or Windows NT 4.0, a program can call into the shell directly.

MORE INFORMATION

The RunDLL32 utility that shipped with Windows 95 and Windows NT 4.0 allows you to invoke a function exported from a DLL. The Windows 95 and Windows NT 4.0 shells don't call Control.exe when you start the control panel. Instead, the shell invokes a Control_RunDLL function in Shell32.dll. With this information, you can use with the following command line to invoke a control panel applet:

   rundll32.exe shell32.dll,Control_RunDLL mycontrol.cpl

NOTE: The command "Control_RunDLL" is case sensitive and must match the case shown exactly.

This starts the first control panel applet in Mycontrol.cpl. If you have multiple control panel applets in Mycontrol.cpl, you need to add to the line as shown here:

   rundll32.exe shell32.dll,Control_RunDLL mycontrol.cpl,@1

Here @1 specifies the second (zero-based) applet in the .cpl file. If you don't specify this parameter, @0 is used as the default.

There is one more parameter you can add. It serves as the command line parameters passed to the control panel applet in the CPL_STARTWPARM notification. For example, a lot of the system's control panel applets take the page number (one based, not zero based) as the command line parameter. For example, if you want to start the Add/Remove Programs applet at the Windows Setup page, so you can instruct the user to add extra system components, you can use this code:

   rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl,@0,2

NOTE: If you put a space after the comma in the commands above, you will get the error:

   Error in shell32.dll
   Missing entry.


Additional query words: Windows 95 debug CPL
Keywords : UsrExt kbhw
Platform : NT Win95 WINDOWS
Issue type : kbhowto


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 9, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.