Every control panel application DLL must export the standard entry-point function, CPlApplet. This function receives requests in the form of control panel messages and then carries out the requested operation—initializing the application, displaying and managing dialog boxes, and closing the application.
When the controlling application first loads the control panel application, it retrieves the address of the CPlApplet function. The control panel application can then use that address to make additional calls to the CPlApplet function and pass messages to it. The following table shows the messages that the controlling application can pass to CPlApplet.
Message |
Description |
CPL_INIT | Sent immediately after the DLL containing the control panel application is loaded. The message prompts CPlApplet to perform initialization procedures, including memory allocation. |
CPL_GETCOUNT | Sent after the CPL_INIT message to prompt CPlApplet to return a number that indicates how many dialog boxes it supports. |
CPL_NEWINQUIRE | Sent after the CPL_GETCOUNT message to prompt CPlApplet to provide data about a specified control panel application. The lParam1 parameter is the control panel application index, from 0 through the number returned by CPL_GETCOUNT. The lParam2 parameter is a pointer to a NEWCPINFO structure to be filled. |
CPL_DBLCLK | Sent to notify CPlApplet that a user has chosen the icon associated with a specified control panel application. CPlApplet should display the corresponding control panel application and carry out any user-specified tasks. The LOWORD of lParam1 contains the control panel application index, the HIWORD contains the index of the tab to start at. The function only returns when the user quits the control panel application. |
CPL_STOP | Sent once for each control panel application before the controlling application shuts down. CPlApplet should free any memory associated with the given control panel application. |
CPL_EXIT | Sent after the last CPL_STOP message and immediately before the controlling application uses the FreeLibrary function to free the DLL containing the control panel application. CPlApplet should free any remaining memory and prepare to shut down. |