home *** CD-ROM | disk | FTP | other *** search
/ Komputer for Alle 1999 #5 / 1999 CD 5 (black).iso / Delphi3 / install / data.z / CPL.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-08-04  |  7.0 KB  |  177 lines

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