15.2 Creating a Control Panel Application

A Control Panel application must reside in a DLL that includes a standard entry-point function named CPlApplet. The application must include the CPL.H header file for the definition of the Control Panel messages. Control Panel communicates with the DLL by sending the following CPL messages to the CPlApplet function:

Message Description

CPL_DBLCLK Sent when the user double-clicks an application icon. In response to this message, the DLL should start its configuration process, usually displaying a dialog box.
CPL_EXIT Sent after the last CPL_STOP message and immediately before Control Panel calls the FreeLibrary function for the DLL. In response to this message, the DLL should free any remaining memory and prepare to exit.
CPL_GETCOUNT Sent after the CPL_INIT message, to prompt the DLL to return a number indicating how many applications it services.
CPL_INIT Sent immediately after the DLL is loaded, to prompt the DLL to perform initialization procedures, including memory allocation.
CPL_INQUIRE Sent after the CPL_GETCOUNT message, to prompt the DLL to provide information about each application. The handler for this message is a good place to include any initialization required by individual applications.
CPL_NEWINQUIRE Sent to a Control Panel DLL to request information about an application that the DLL supports. The CPL_NEWINQUIRE message is the same as the CPL_INQUIRE message except that its second parameter (lParam2) is a pointer to a NEWCPLINFO structure instead of a CPLINFO structure. New applications should use CPL_NEWINQUIRE instead of CPL_INQUIRE.
CPL_SELECT Sent when the user selects an application icon.
CPL_STOP Sent once for each application before Control Panel ends. In response to this message, the DLL should free any memory associated with the individual application for which the message is sent.

For more information about these messages, see the Microsoft Windows Programmer's Reference, Volume 3.