home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c083 / 14.ddi / GENINC.PAK / CPL.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-02  |  6.3 KB  |  181 lines

  1. /*****************************************************************************\
  2. *                                                                             *
  3. * cpl.h -       Control panel extension DLL definitions                       *
  4. *                                                                             *
  5. *                                                                             *
  6. ******************************************************************************
  7. *  General rules for being installed in the Control Panel:
  8. *
  9. *      1) The DLL must export a function named CPlApplet which will handle
  10. *         the messages discussed below.
  11. *      2) If the applet needs to save information in CONTROL.INI minimize
  12. *         clutter by using the application name [MMCPL.appletname].
  13. *      2) If the applet is refrenced in CONTROL.INI under [MMCPL] use
  14. *         the following form:
  15. *              ...
  16. *              [MMCPL]
  17. *              uniqueName=c:\mydir\myapplet.dll
  18. *              ...
  19. *
  20. *
  21. *  The order applet DLL's are loaded by CONTROL.EXE is:
  22. *
  23. *      1) MAIN.CPL is loaded from the windows system directory.
  24. *
  25. *      2) Installable drivers that are loaded and export the
  26. *         CplApplet() routine.
  27. *
  28. *      3) DLL's specified in the [MMCPL] section of CONTROL.INI.
  29. *
  30. *      4) DLL's named *.CPL from windows system directory.
  31. *
  32. */
  33.  
  34. /*
  35.  *      C/C++ Run Time Library - Version 6.0
  36.  *
  37.  *      Copyright (c) 1992, 1993 by Borland International
  38.  *      All Rights Reserved.
  39.  *
  40.  */
  41.  
  42.  
  43. #ifndef __CPL_H         /* prevent multiple includes */
  44. #define __CPL_H
  45.  
  46. #ifndef __WINDOWS_H
  47. #include <windows.h>    /* <windows.h> must be included */
  48. #endif  /* __WINDOWS_H */
  49.  
  50. #if !defined(WINVER) || (WINVER < 0x030a)
  51. #error Control panel extensions require Windows 3.1
  52. #endif
  53.  
  54. #ifndef RC_INVOKED
  55. #pragma option -a-      /* Assume byte packing throughout */
  56. #endif  /* RC_INVOKED */
  57.  
  58. #ifdef __cplusplus
  59. extern "C" {            /* Assume C declarations for C++ */
  60. #endif  /* __cplusplus */
  61.  
  62. /*
  63.  * CONTROL.EXE will answer this message and launch an applet
  64.  *
  65.  * WM_CPL_LAUNCH
  66.  *
  67.  *      wParam      - window handle of calling app
  68.  *      lParam      - LPSTR of name of applet to launch
  69.  *
  70.  * WM_CPL_LAUNCHED
  71.  *
  72.  *      wParam      - TRUE/FALSE if applet was launched
  73.  *      lParam      - NULL
  74.  *
  75.  * CONTROL.EXE will post this message to the caller when the applet returns
  76.  * (ie., when wParam is a valid window handle)
  77.  *
  78.  */
  79. #define WM_CPL_LAUNCH   (WM_USER+1000)
  80. #define WM_CPL_LAUNCHED (WM_USER+1001)
  81.  
  82. /* A function prototype for CPlApplet() */
  83.  
  84. #ifndef __FLAT__
  85. typedef LRESULT (CALLBACK *APPLET_PROC)(HWND hwndCpl, UINT msg, LPARAM lParam1, LPARAM lParam2);
  86. #else
  87. //typedef LRESULT (APIENTRY *APPLET_PROC)(HWND hwndCpl, UINT msg, LPARAM lParam1, LPARAM lParam2);
  88. typedef LONG (APIENTRY *APPLET_PROC)(HWND hwndCpl, UINT msg, LONG lParam1, LONG lParam2);
  89. #endif  /* __FLAT__  */
  90.  
  91. /* The data structure CPlApplet() must fill in. */
  92.  
  93. typedef struct tagCPLINFO
  94. {
  95.     int     idIcon;     /* icon resource id, provided by CPlApplet() */
  96.     int     idName;     /* name string res. id, provided by CPlApplet() */
  97.     int     idInfo;     /* info string res. id, provided by CPlApplet() */
  98.     LONG    lData;      /* user defined data */
  99. } CPLINFO, *PCPLINFO, FAR *LPCPLINFO;
  100.  
  101. typedef struct tagNEWCPLINFO
  102. {
  103.     DWORD       dwSize;         /* similar to the commdlg */
  104.     DWORD       dwFlags;
  105.     DWORD       dwHelpContext;  /* help context to use */
  106.     LONG        lData;          /* user defined data */
  107.     HICON       hIcon;          /* icon to use, this is owned by CONTROL.EXE (may be deleted) */
  108.     char        szName[32];     /* short name */
  109.     char        szInfo[64];     /* long name (status line) */
  110.     char        szHelpFile[128];/* path to help file to use */
  111. } NEWCPLINFO, *PNEWCPLINFO, FAR *LPNEWCPLINFO;
  112.  
  113.  
  114. /* The messages CPlApplet() must handle: */
  115.  
  116. #define CPL_INIT        1
  117. /*  This message is sent to indicate CPlApplet() was found. */
  118. /*  lParam1 and lParam2 are not defined. */
  119. /*  Return TRUE or FALSE indicating whether the control panel should proceed. */
  120.  
  121.  
  122. #define CPL_GETCOUNT    2
  123. /*  This message is sent to determine the number of applets to be displayed. */
  124. /*  lParam1 and lParam2 are not defined. */
  125. /*  Return the number of applets you wish to display in the control */
  126. /*  panel window. */
  127.  
  128.  
  129. #define CPL_INQUIRE     3
  130. /*  This message is sent for information about each applet. */
  131. /*  lParam1 is the applet number to register, a value from 0 to */
  132. /*  (CPL_GETCOUNT - 1).  lParam2 is a far ptr to a CPLINFO structure. */
  133. /*  Fill in CPL_INFO's idIcon, idName, idInfo and lData fields with */
  134. /*  the resource id for an icon to display, name and description string ids, */
  135. /*  and a long data item associated with applet #lParam1. */
  136.  
  137.  
  138. #define CPL_SELECT      4
  139. /*  This message is sent when the applet's icon has been clicked upon. */
  140. /*  lParam1 is the applet number which was selected.  lParam2 is the */
  141. /*  applet's lData value. */
  142.  
  143.  
  144. #define CPL_DBLCLK      5
  145. /*  This message is sent when the applet's icon has been double-clicked */
  146. /*  upon.  lParam1 is the applet number which was selected.  lParam2 is the */
  147. /*  applet's lData value. */
  148. /*  This message should initiate the applet's dialog box. */
  149.  
  150.  
  151. #define CPL_STOP        6
  152. /*  This message is sent for each applet when the control panel is exiting. */
  153. /*  lParam1 is the applet number.  lParam2 is the applet's lData  value. */
  154. /*  Do applet specific cleaning up here. */
  155.  
  156.  
  157. #define CPL_EXIT        7
  158. /*  This message is sent just before the control panel calls FreeLibrary. */
  159. /*  lParam1 and lParam2 are not defined. */
  160. /*  Do non-applet specific cleaning up here. */
  161.  
  162.  
  163. #define CPL_NEWINQUIRE  8
  164. /* this is the same as CPL_INQUIRE execpt lParam2 is a pointer to a */
  165. /* NEWCPLINFO structure.  this will be sent before the CPL_INQUIRE */
  166. /* and if it is responed to (return != 0) CPL_INQUIRE will not be sent */
  167.  
  168.  
  169. #define CPL_DO_PRINTER_SETUP    100    /* ;Internal */
  170. #define CPL_DO_NETPRN_SETUP     101    /* ;Internal */
  171.  
  172. #ifdef __cplusplus
  173. }                       /* End of extern "C" { */
  174. #endif  /* __cplusplus */
  175.  
  176. #ifndef RC_INVOKED
  177. #pragma option -a.      /* Revert to default packing */
  178. #endif  /* RC_INVOKED */
  179.  
  180. #endif  /* __CPL_H */
  181.