{===========================================================================}
{
  CPL.PAS - Control Panel API unit for Control Panel Applet Demo

  Author: Ted Houts thouts@rockway.com

  CPL.PAS contains the definitions and constants related to Control Panel
  applets.  Converted to Pascal from "cpl.h" (v3.10) from Visual C++
  development environment. THIS IS NOT AN ENTIRE CONVERSION FROM CPL.H
  as only the information required of this project was converted. The
  conversion also assumes this project will run in 32bit Windows.

}
{===========================================================================}
unit cpl;

interface
uses Windows,Messages;
const


//these are the messages the export function CPlApplet() should handle


  CPL_INIT = 1; //sent once to the cpl, when Control panel is started

  CPL_GETCOUNT = 2; //this message is called to determine the number of dialog
                    //boxes the cpl supports

  CPL_INQUIRE = 3; //sent each time information is needed to be gathered
                   //(by control panel applet) -> icon to show, title etc...

  CPL_SELECT = 4; //obsolete

  CPL_DBLCLK = 5; //this message is received when one of the icons has
                  //been double clicked.

  CPL_STOP = 6; //time to clean up specific applet, control panel is exiting

  CPL_EXIT = 7; //called once to indicate control panel is unloading your
                //dll.  Do any global clean up here

  CPL_NEWINQUIRE = 8;  //An updated version of CPL_INQUIRE, but the information
                       //requested is returned in a different format
                       //Control panel applets should handle both the
                       //CPL_INQUIRE and CPL_NEWINQUIRE message.

  CPL_SETUP = 200; //only sent when applet started during a system installation
                   //from the command line. Not used in this project


  CPL_STARTWPARMSA = 9;
  CPL_STARTWPARMSW = 10; // These messages will REPLACE CPL_DBLCLK if
                         // the applet is being started by rundll32.exe
                         // (as opposed to the user clicking the icon in
                         // control panel). lParam2 will be a PChar of the
                         // parameter string passed.  The difference between
                         // the two is a UNICODE topic.


  CPL_STARTWPARAMS = CPL_STARTWPARMSA; //Will get both the CPL_STARTWPARAMSA,
                                        //and CPL_STARTWPARAMSW unless trapping
                                        //one and returning 0.  Since the
                                        //difference is a UNICODE definition,
                                        //we will trap and handle only this one


//other related definitions not used in this project
  CPL_DYNAMIC_RES = 0; //for dynamic resource loading (as opposed to caching the
                       //information), not used in this project

  WM_CPL_LAUNCH  =  (WM_USER+1000); //send to Control Panel to launch an applet
                                    //wParam - Window handle of app sending msg
                                    //lParam - PChar .cpl file to launch
  WM_CPL_LAUNCHED  = (WM_USER+1001); //recieve from Control Panel when applet
                                    //launched
                                    //wParam - 1 - if launched 0 - not launched
                                    //lParam - not used




//lParam2 in CPL_INQUIRE message is a pointer to this record, which is
//filled with the information
type TCplInfo = record
       idIcon : Integer; //the resource id for the icon
       idName : Integer; //the resource id for the name of the applet
       idInfo : Integer; //the resource id for the title of the applet
       lData : LongInt;  //can store custom data here
     end;
     PCplInfo = ^TCplInfo;


//for unicode support the chars can be defined as WChar;
// see typedef struct tagNEWCPLINFOW in cpl.h
type TNewCplInfoA = record
       dwSize : DWORD; //the size of this record
       dwFlags : DWORD;
       dwHelpContext : DWORD; //help context for the applet
       lData : LongInt; //can store custom data here
       IconH : HIcon; //handle of icon to display in control panel
       szName : array [0..31] of Char; //title of applet shown under
                                       //icon in control panel
       szInfo : array [0..63] of Char; //description of applet shown under
                                       //icon in control panel
       szHelpFile : array [0..127] of Char;  //path to the help file
     end;
     PNewCplInfoA = ^TNewCplInfoA;

type TNewCplInfo = TNewCplInfoA;
type PNewCplInfo = ^TNewCplInfoA;

implementation

end.

