home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / Runimage / Delphi50 / Source / Rtl / Win / CPL.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1999-08-11  |  8.1 KB  |  212 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Borland Delphi Run-time Library                 }
  5. {       Control Panel extension DLL definitions         }
  6. {                                                       }
  7. {       Copyright (c) 1985-1999, Microsoft Corporation  }
  8. {                                                       }
  9. {       Translator: Inprise Corporation                 }
  10. {                                                       }
  11. {*******************************************************}
  12.  
  13. unit CPL;
  14.  
  15. {$HPPEMIT '#include <cpl.h>'}
  16.  
  17. interface
  18.  
  19. uses Messages, Windows;
  20.  
  21. {  General rules for being installed in the Control Panel:
  22.  
  23.       1) The DLL must export a function named CPlApplet which will handle
  24.          the messages discussed below.
  25.       2) If the applet needs to save information in CONTROL.INI minimize
  26.          clutter by using the application name [MMCPL.appletname].
  27.       2) If the applet is refrenced in CONTROL.INI under [MMCPL] use
  28.          the following form:
  29.               ...
  30.               [MMCPL]
  31.               uniqueName=c:\mydir\myapplet.dll
  32.               ...
  33.  
  34.  
  35.   The order applet DLL's are loaded by CONTROL.EXE is:
  36.  
  37.       1) MAIN.CPL is loaded from the windows system directory.
  38.  
  39.       2) Installable drivers that are loaded and export the
  40.          CplApplet() routine.
  41.  
  42.       3) DLL's specified in the [MMCPL] section of CONTROL.INI.
  43.  
  44.       4) DLL's named *.CPL from windows system directory.
  45.  
  46.  
  47.  CONTROL.EXE will answer this message and launch an applet
  48.  
  49.  WM_CPL_LAUNCH
  50.  
  51.       wParam      - window handle of calling app
  52.       lParam      - LPTSTR of name of applet to launch
  53.  
  54.  WM_CPL_LAUNCHED
  55.  
  56.       wParam      - TRUE/FALSE if applet was launched
  57.       lParam      - NULL
  58.  
  59.  CONTROL.EXE will post this message to the caller when the applet returns
  60.  (ie., when wParam is a valid window handle)
  61. }
  62.  
  63. const
  64.   {$EXTERNALSYM WM_CPL_LAUNCH}
  65.   WM_CPL_LAUNCH   = (WM_USER+1000);
  66.   {$EXTERNALSYM WM_CPL_LAUNCHED}
  67.   WM_CPL_LAUNCHED = (WM_USER+1001);
  68.  
  69.   // The messages CPlApplet() must handle:
  70.   {$EXTERNALSYM CPL_DYNAMIC_RES}
  71.   CPL_DYNAMIC_RES = 0;
  72.   { This constant may be used in place of real resource IDs for the idIcon,
  73.     idName or idInfo members of the CPLINFO structure.  Normally, the system
  74.     uses these values to extract copies of the resources and store them in a
  75.     cache.  Once the resource information is in the cache, the system does not
  76.     need to load a CPL unless the user actually tries to use it.
  77.  
  78.     CPL_DYNAMIC_RES tells the system not to cache the resource, but instead to
  79.     load the CPL every time it needs to display information about an item.  This
  80.     allows a CPL to dynamically decide what information will be displayed, but
  81.     is SIGNIFICANTLY SLOWER than displaying information from a cache.
  82.     Typically, CPL_DYNAMIC_RES is used when a control panel must inspect the
  83.     runtime status of some device in order to provide text or icons to display.
  84.   }
  85.   {$EXTERNALSYM CPL_INIT}
  86.   CPL_INIT = 1;
  87.   { This message is sent to indicate CPlApplet() was found. lParam1 and lParam2
  88.     are not defined. Return TRUE or FALSE indicating whether the control panel
  89.     should proceed.
  90.   }
  91.   {$EXTERNALSYM CPL_GETCOUNT}
  92.   CPL_GETCOUNT = 2;
  93.   { This message is sent to determine the number of applets to be displayed.
  94.     lParam1 and lParam2 are not defined. Return the number of applets you wish
  95.     to display in the control
  96.     panel window.
  97.   }
  98.   {$EXTERNALSYM CPL_INQUIRE}
  99.   CPL_INQUIRE = 3;
  100.   { This message is sent for information about each applet. lParam1 is the
  101.     applet number to register, a value from 0 to(CPL_GETCOUNT - 1).
  102.     lParam2 is a far ptr to a CPLINFO structure. Fill in CPL_INFO's idIcon,
  103.     idName, idInfo and lData fields with the resource id for an icon to
  104.     display, name and description string ids, and a long data item
  105.     associated with applet #lParam1.
  106.   }
  107.   {$EXTERNALSYM CPL_SELECT}
  108.   CPL_SELECT = 4;
  109.   { This message is sent when the applet's icon has been clicked upon.
  110.     lParam1 is the applet number which was selected.  lParam2 is the
  111.     applet's lData value.
  112.   }
  113.   {$EXTERNALSYM CPL_DBLCLK}
  114.   CPL_DBLCLK = 5;
  115.   { This message is sent when the applet's icon has been double-clicked
  116.     upon.  lParam1 is the applet number which was selected.  lParam2 is the
  117.     applet's lData value. This message should initiate the applet's dialog box.
  118.   }
  119.   {$EXTERNALSYM CPL_STOP}
  120.   CPL_STOP = 6;
  121.   { This message is sent for each applet when the control panel is exiting.
  122.     lParam1 is the applet number.  lParam2 is the applet's lData  value.
  123.     Do applet specific cleaning up here.
  124.   }
  125.   {$EXTERNALSYM CPL_EXIT}
  126.   CPL_EXIT = 7;
  127.   { This message is sent just before the control panel calls FreeLibrary.
  128.     lParam1 and lParam2 are not defined.
  129.     Do non-applet specific cleaning up here.
  130.   }
  131.   {$EXTERNALSYM CPL_NEWINQUIRE}
  132.   CPL_NEWINQUIRE = 8;
  133.   { This is the same as CPL_INQUIRE execpt lParam2 is a pointer to a
  134.     NEWCPLINFO structure.  this will be sent before the CPL_INQUIRE
  135.     and if it is responed to (return != 0) CPL_INQUIRE will not be sent
  136.   }
  137.   {$EXTERNALSYM CPL_STARTWPARMS}
  138.   CPL_STARTWPARMS = 9;
  139.   { This message parallels CPL_DBLCLK in that the applet should initiate
  140.     its dialog box.  where it differs is that this invocation is coming
  141.     out of RUNDLL, and there may be some extra directions for execution.
  142.     lParam1: the applet number.
  143.     lParam2: an LPSTR to any extra directions that might exist.
  144.     returns: TRUE if the message was handled; FALSE if not.
  145.   }
  146.   {$EXTERNALSYM CPL_SETUP}
  147.   CPL_SETUP = 200;
  148.   { This message is internal to the Control Panel and MAIN applets.
  149.     It is only sent when an applet is invoked from the Command line
  150.     during system installation.
  151.   }
  152.  
  153. type
  154.   //A function prototype for CPlApplet()
  155.   {$EXTERNALSYM APPLET_PROC}
  156.   APPLET_PROC = function (hwndCPl: THandle; uMsg: DWORD;
  157.                          lParam1, lParam2: Longint): Longint; stdcall;
  158.   TCPLApplet = APPLET_PROC;
  159.  
  160.   //The data structure CPlApplet() must fill in.
  161.   PCPLInfo = ^TCPLInfo;
  162.   {$EXTERNALSYM tagCPLINFO}
  163.   tagCPLINFO = packed record
  164.      idIcon: Integer;  // icon resource id, provided by CPlApplet()
  165.      idName: Integer;  // name string res. id, provided by CPlApplet()
  166.      idInfo: Integer;  // info string res. id, provided by CPlApplet()
  167.      lData : Longint;  // user defined data
  168.   end;
  169.   {$EXTERNALSYM CPLINFO}
  170.   CPLINFO = tagCPLINFO;
  171.   TCPLInfo = tagCPLINFO;
  172.  
  173.   PNewCPLInfoA = ^TNewCPLInfoA;
  174.   PNewCPLInfoW = ^TNewCPLInfoW;
  175.   PNewCPLInfo = PNewCPLInfoA;
  176.   {$EXTERNALSYM tagNEWCPLINFOA}
  177.   tagNEWCPLINFOA = packed record
  178.     dwSize:        DWORD;   // similar to the commdlg
  179.     dwFlags:       DWORD;
  180.     dwHelpContext: DWORD;   // help context to use
  181.     lData:         Longint; // user defined data
  182.     hIcon:         HICON;   // icon to use, this is owned by CONTROL.EXE (may be deleted)
  183.     szName:        array[0..31] of AnsiChar;    // short name
  184.     szInfo:        array[0..63] of AnsiChar;    // long name (status line)
  185.     szHelpFile:    array[0..127] of AnsiChar;   // path to help file to use
  186.   end;
  187.   {$EXTERNALSYM tagNEWCPLINFOW}
  188.   tagNEWCPLINFOW = packed record
  189.     dwSize:        DWORD;   // similar to the commdlg
  190.     dwFlags:       DWORD;
  191.     dwHelpContext: DWORD;   // help context to use
  192.     lData:         Longint; // user defined data
  193.     hIcon:         HICON;   // icon to use, this is owned by CONTROL.EXE (may be deleted)
  194.     szName:        array[0..31] of WideChar;    // short name
  195.     szInfo:        array[0..63] of WideChar;    // long name (status line)
  196.     szHelpFile:    array[0..127] of WideChar;   // path to help file to use
  197.   end;
  198.   {$EXTERNALSYM tagNEWCPLINFO}
  199.   tagNEWCPLINFO = tagNEWCPLINFOA;
  200.   {$EXTERNALSYM NEWCPLINFOA}
  201.   NEWCPLINFOA = tagNEWCPLINFOA;
  202.   {$EXTERNALSYM NEWCPLINFOW}
  203.   NEWCPLINFOW = tagNEWCPLINFOW;
  204.   {$EXTERNALSYM NEWCPLINFO}
  205.   NEWCPLINFO = NEWCPLINFOA;
  206.   TNewCPLInfoA = tagNEWCPLINFOA;
  207.   TNewCPLInfoW = tagNEWCPLINFOW;
  208.   TNewCPLInfo = TNewCPLInfoA;
  209.  
  210. implementation
  211. end.
  212.