Previous: Application Responsibilities and Operation To the Table of Content Next: Writing Dinamic-Link Libraries (DLLs)

- 6.8 -
Win32 Programming

Application Entry-Point Function

Every Control Panel application must export the standard entry-point function, CPlApplet (WIN32.HLP). This function receives requests, in the form of Control Panel (CPL) messages, and carries out the requested work, such as initializing the application, displaying and managing the dialog box(es), and closing the application.

When the controlling application first loads the Control Panel application, it retrieves the address of the CPlApplet function and subsequently uses the address to call the function and pass it messages. The controlling application may send the following messages:

CPL_DBLCLK (WIN32.HLP)
Sent to notify CPlApplet that the user has chosen the icon associated with a given dialog box. CPlApplet should display the corresponding dialog box and carry out any user-specified tasks.

CPL_EXIT (WIN32.HLP)
Sent after the last CPL_STOP message and immediately before the controlling application uses the FreeLibrary function (WIN32.HLP) to free the DLL containing the Control Panel application. CPlApplet should free any remaining memory and prepare to close.

CPL_GETCOUNT (WIN32.HLP)
Sent after the CPL_GETCOUNT message (WIN32.HLP) to prompt CPlApplet to return a number indicating how many dialog boxes it supports.

CPL_INIT (WIN32.HLP)
Sent immediately after the DLL containing the Control Panel application is loaded, to prompt CPlApplet to perform initialization procedures, including memory allocation.

CPL_INQUIRE (WIN32.HLP)
Sent after the CPL_GETCOUNT message, to prompt CPlApplet to provide information about a specified dialog box. The lParam2 parameter of CPlApplet points to a TCPLInfo structure (WIN32.HLP).

CPL_NEWINQUIRE (WIN32.HLP)
Sent after the CPL_GETCOUNT message, to prompt CPlApplet to provide information about a specified dialog box. The lParam2 parameter is a pointer to a TNewCPLInfo structure (WIN32.HLP). For better performance on Windows 95 and Windows NT version 4.0, your application should process CPL_INQUIRE and not CPL_NEWINQUIRE.

CPL_SELECT (WIN32.HLP)
This message is obsolete. Current versions of Windows do not send this message.

CPL_STOP (WIN32.HLP)
Sent once for each dialog box before the controlling application closes. CPlApplet should free any memory associated with the given dialog box.

You will find an example of Control Panel Application in
\TMTPL\SAMPLES\WIN32\CPL subdirectory.


Previous: Application Responsibilities and Operation To the Table of Content Next: Writing Dinamic-Link Libraries (DLLs)
Application Responsibilities and Operation Table of Content Writing Dinamic-Link Libraries (DLLs)

- 6.8 -