15.2.1 Creating the Entry-Point Function

Control Panel communicates with an application DLL through the CPlApplet function. Be sure to export this function by listing it in the EXPORTS statement of your module-definition (.DEF) file. The CPlApplet function handles the messages listed previously, performing three main tasks:

Task Result

Initializing the application (CPL_INIT, CPL_INQUIRE) Allocates any memory needed and gives Control Panel the information needed to display the application icon.
Running the application (CPL_DBLCLK) Passes control to a dialog box and its associated message processor.
Closing the application (CPL_STOP, CPL_EXIT) Frees any memory allocated and prepares to exit.

The CPlApplet function has the following format:

LONG CALLBACK* CPlApplet(hwndCPL, iMessage, lParam1, lParam2)

The hwndCPL parameter contains the handle of the Control Panel window.
The iMessage parameter contains one of the CPL messages listed previously.
The lParam1 and lParam2 parameters contain message-dependent values. For more information about the CPlApplet function, see the Microsoft Windows Programmer's Reference, Volume 2.