Example 1:
The Control Panel callback function
// if _declspec(export) doesn't work for this function (ie. The // control panel app does not Link to it correctly), use the DEF file // to export this function from the DLL. You will need a // File name: ControlApplet.def LIBRARY ControlApplet DESCRIPTION 'ControlPanel Applet' EXPORTS CplApplet @1 // This is what ControlApplet.cpp will look like. // This function takes a window handle, a message and a couple of // message specific parameters. // hWnd: handle to Control Panel window LRESULT __stdcall CplApplet (HWND hWnd, UINT uMsg, LPARAM lParam1, LPARAM lParam2) { switch (uMsg) { case CPL_INIT: // The message prompts CPlApplet to perform // initialization. break; case CPL_GETCOUNT: // sent to Control Panel app to retrieve the // number of dialogs supported by the application. break; case CPL_IDNAME: _tcscpy ((LPTSTR)lParam2, TEXT("SampleApplet")); lParam1 = 1; return (lParam2); case CPL_NEWINQUIRE: // Control Panel sends the CPL_NEWINQUIRE message // once for each Dialog box supported by your // application. break; case CPL_DBLCLK: // This message sent to Control Panel application // when the user double-clicks the icon in the // control panel explorer. break; case CPL_STOP: // Sent once for each dialog box when the // application controlling the // Control Panel application closes. break; case CPL_EXIT: // Sent once to a Control Panel application before // the controlling application // releases the DLL that contains the application. break; } }