Desaware Home
Products    Purchase    Publishing    Articles   Support    Company    Contact    
Product FAQ
Licensing System
CC Factory
Event Log Toolkit
IniFile Tool-5M
NT Service Toolkit
OneTime Download
VBX Legacy
Professional Services


Contact Desaware and order today

Sign up for Desaware's Newsletter for the latest news and tech tips.

SpyWorks Support

Frequently Asked Questions - Control Panel Applets

  1. When I try to create a Control Panel Applet on some systems I get an error message.
  2. I'm trying to create a Control Panel Applet but am confused about the steps required to create one.

1. I use SpyWorks to create a Control Panel  Applet. On certain systems, under certain circumstances, I get an error message "An error occurred while Windows was working with Control Panel file C:\Windows\System\MyCplApp.cpl" when I closed the Control Panel. This message may appear even though I did not open up my Control Panel Applet.

We found an undocumented "behavior" of the Control Panel. Under certain circumstances, the Control Panel may send a Control Panel Applet the CPL_INIT message when the Control Panel (not the Control Panel Applet) is opened. The purpose of sending this message is to enumerate the number of applets or to retrieve an applet's icon. When this occurs, the applet will not receive a corresponding CPL_STOP or CPL_EXIT message when it is unloaded (immediately after all the applets have been enumerated or after the icons have been retrieved). Also, in this weird situation, the Control Panel will send the CPL_STOP and CPL_EXIT messages (without a corresponding CPL_INIT message) to the applets when the Control Panel is closed. In our Control Panel Applet implementation, we create a global dwExporter object on CPL_INIT and destroy it on CPL_STOP or CPL_EXIT. Our implementation will trigger an error when our applet receives a CPL_STOP in this weird situation because we never received a corresponding CPL_INIT to create our object in the first place. The solution is to verify that the dwExporter object exists before attempting to destroy it. In the Select Case for the CPL_STOP and CPL_EXIT messages of the CPLApplet function, change the code from:

Set holder = Nothing


If Not holder Is Nothing Then Set holder = Nothing

2. I'm trying to create a Control Panel Applet but am confused about the steps required to create one.

The easiest way to create a new Control Panel Applet is to start with our example as a template.
Then do the following steps:   

  1. Make a copy of the CPApplet directory and put it in a subdirectory call "NewCPApp".
  2. Open the CPLTest1.vbp project and change Project "Name" (NOT the project file name) to "NewCPLTest".
  3. Modify the frmApplet Form - add another label or change something simple so you'll know it's not the same form.
  4. Compile project, name it "NewCPL.dll".
  5. Run the Desaware Export Utility. This utility is used to create the actual CPL file.
  6. Using the Export Utility, "Open" the CPLTest.drc file in the directory containing the NewCPLTest project.
  7. Select the "Strings" Resource Type in the drop down list box, you should see two entries.
  8. Select the "2 SpyWorks Applet" entry (this is the text that is displayed in the Control Panel for our Applet), then the "Resource - Edit" menu.
  9. Change the "SpyWorks Applet" string to "New CP Applet".
  10. Select the "Project - Set Source Project" menu.
  11. Enter the Project NAME (NOT the project file name) of your control panel applet project, in this case, it is "NewCPLTest" (see step 2).
  12. Select the "Project - Set Alias DLL" menu.
  13. Enter "NewCPL.cpl" as the Alias DLL.
  14. Select the "Project - Build DLL" menu, you should then get a "Success - Alias DLL built successfully" message box.
  15. Move the NewCPL.cpl file to your System directory.
  16. Open the Control Panel, and you should see an icon similar to the SpyWorks Control Panel Applet icon but with a different string ("New CP Applet" instead of "SpyWorks Applet").
  17. To change the control panel applet icon, you can remove the existing icon (select the Icons Resource Type) from the CPLTest.drc file using the Desaware Export Utility and add your own - be sure to give it the value "2" - this is referenced as "cpli.idIcon" in the Main CPlApplet function under the "Case CPL_INQUIRE" section.

Products    Purchase    Articles    Support    Company    Contact
Copyright© 2012 Desaware, Inc. All Rights Reserved.    Privacy Policy