home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / bc45 / msinc.pak / CPL.H < prev    next >
C/C++ Source or Header  |  1997-07-23  |  14KB  |  380 lines

  1. #if !defined(__FLAT__)
  2. /*****************************************************************************\
  3. *                                                                             *
  4. * cpl.h -       Control panel extension DLL definitions                       *
  5. *                                                                             *
  6. *               Version 3.10                                                  *
  7. *                                                                             *
  8. ******************************************************************************
  9. *  General rules for being installed in the Control Panel:
  10. *
  11. *      1) The DLL must export a function named CPlApplet which will handle
  12. *         the messages discussed below.
  13. *      2) If the applet needs to save information in CONTROL.INI minimize
  14. *         clutter by using the application name [MMCPL.appletname].
  15. *      2) If the applet is refrenced in CONTROL.INI under [MMCPL] use
  16. *         the following form:
  17. *              ...
  18. *              [MMCPL]
  19. *              uniqueName=c:\mydir\myapplet.dll
  20. *              ...
  21. *
  22. *
  23. *  The order applet DLL's are loaded by CONTROL.EXE is:
  24. *
  25. *      1) MAIN.CPL is loaded from the windows system directory.
  26. *
  27. *      2) Installable drivers that are loaded and export the
  28. *         CplApplet() routine.
  29. *
  30. *      3) DLL's specified in the [MMCPL] section of CONTROL.INI.
  31. *
  32. *      4) DLL's named *.CPL from windows system directory.
  33. *
  34. */
  35.  
  36. /*
  37.  *      C/C++ Run Time Library - Version 6.5
  38.  *
  39.  *      Copyright (c) 1994 by Borland International
  40.  *      All Rights Reserved.
  41.  *
  42.  */
  43.  
  44. #ifndef _INC_CPL
  45. #define _INC_CPL
  46. #define __CPL_H
  47.  
  48. #include <pshpack1.h>
  49.  
  50. #ifdef __cplusplus
  51. extern "C" {            /* Assume C declarations for C++ */
  52. #endif /* __cplusplus */
  53.  
  54. /*
  55.  * CONTROL.EXE will answer this message and launch an applet
  56.  *
  57.  * WM_CPL_LAUNCH
  58.  *
  59.  *      wParam      - window handle of calling app
  60.  *      lParam      - LPTSTR of name of applet to launch
  61.  *
  62.  * WM_CPL_LAUNCHED
  63.  *
  64.  *      wParam      - TRUE/FALSE if applet was launched
  65.  *      lParam      - NULL
  66.  *
  67.  * CONTROL.EXE will post this message to the caller when the applet returns
  68.  * (ie., when wParam is a valid window handle)
  69.  *
  70.  */
  71. #define WM_CPL_LAUNCH   (WM_USER+1000)
  72. #define WM_CPL_LAUNCHED (WM_USER+1001)
  73.  
  74. /* A function prototype for CPlApplet() */
  75.  
  76. typedef LRESULT (CALLBACK *APPLET_PROC)(HWND hwndCpl, UINT msg, LPARAM lParam1, LPARAM lParam2);
  77.  
  78. /* The data structure CPlApplet() must fill in. */
  79.  
  80. typedef struct tagCPLINFO
  81. {
  82.     int     idIcon;     /* icon resource id, provided by CPlApplet() */
  83.     int     idName;     /* name string res. id, provided by CPlApplet() */
  84.     int     idInfo;     /* info string res. id, provided by CPlApplet() */
  85.     LONG    lData;      /* user defined data */
  86. } CPLINFO, *PCPLINFO, FAR *LPCPLINFO;
  87.  
  88. typedef struct tagNEWCPLINFO
  89. {
  90.     DWORD       dwSize;         /* similar to the commdlg */
  91.     DWORD       dwFlags;
  92.     DWORD       dwHelpContext;  /* help context to use */
  93.     LONG        lData;          /* user defined data */
  94.     HICON       hIcon;          /* icon to use, this is owned by CONTROL.EXE (may be deleted) */
  95.     char        szName[32];     /* short name */
  96.     char        szInfo[64];     /* long name (status line) */
  97.     char        szHelpFile[128];/* path to help file to use */
  98. } NEWCPLINFO, *PNEWCPLINFO, FAR *LPNEWCPLINFO;
  99.  
  100. /* The messages CPlApplet() must handle: */
  101.  
  102. #define CPL_INIT        1
  103. /*  This message is sent to indicate CPlApplet() was found. */
  104. /*  lParam1 and lParam2 are not defined. */
  105. /*  Return TRUE or FALSE indicating whether the control panel should proceed. */
  106.  
  107.  
  108. #define CPL_GETCOUNT    2
  109. /*  This message is sent to determine the number of applets to be displayed. */
  110. /*  lParam1 and lParam2 are not defined. */
  111. /*  Return the number of applets you wish to display in the control */
  112. /*  panel window. */
  113.  
  114.  
  115. #define CPL_INQUIRE     3
  116. /*  This message is sent for information about each applet. */
  117. /*  lParam1 is the applet number to register, a value from 0 to */
  118. /*  (CPL_GETCOUNT - 1).  lParam2 is a far ptr to a CPLINFO structure. */
  119. /*  Fill in CPL_INFO's idIcon, idName, idInfo and lData fields with */
  120. /*  the resource id for an icon to display, name and description string ids, */
  121. /*  and a long data item associated with applet #lParam1. */
  122.  
  123.  
  124. #define CPL_SELECT      4
  125. /*  This message is sent when the applet's icon has been clicked upon. */
  126. /*  lParam1 is the applet number which was selected.  lParam2 is the */
  127. /*  applet's lData value. */
  128.  
  129.  
  130. #define CPL_DBLCLK      5
  131. /*  This message is sent when the applet's icon has been double-clicked */
  132. /*  upon.  lParam1 is the applet number which was selected.  lParam2 is the */
  133. /*  applet's lData value. */
  134. /*  This message should initiate the applet's dialog box. */
  135.  
  136.  
  137. #define CPL_STOP        6
  138. /*  This message is sent for each applet when the control panel is exiting. */
  139. /*  lParam1 is the applet number.  lParam2 is the applet's lData  value. */
  140. /*  Do applet specific cleaning up here. */
  141.  
  142.  
  143. #define CPL_EXIT        7
  144. /*  This message is sent just before the control panel calls FreeLibrary. */
  145. /*  lParam1 and lParam2 are not defined. */
  146. /*  Do non-applet specific cleaning up here. */
  147.  
  148.  
  149. #define CPL_NEWINQUIRE    8
  150. /* this is the same as CPL_INQUIRE execpt lParam2 is a pointer to a */
  151. /* NEWCPLINFO structure.  this will be sent before the CPL_INQUIRE */
  152. /* and if it is responed to (return != 0) CPL_INQUIRE will not be sent */
  153.  
  154. #define CPL_DO_PRINTER_SETUP    100    /* ;Internal */
  155. #define CPL_DO_NETPRN_SETUP     101    /* ;Internal */
  156.  
  157. /* This message is internal to the Control Panel and MAIN applets.  */
  158. /* It is only sent when an applet is invoked from the Command line  */
  159. /* during system installation.                                      */
  160. #define CPL_SETUP               200
  161.  
  162. #ifdef __cplusplus
  163. }
  164. #endif    /* __cplusplus */
  165.  
  166. #include <poppack.h>
  167.  
  168. #endif  /* _INC_CPL */
  169.  
  170.  
  171. #else /* !__FLAT__ */
  172. /*****************************************************************************\
  173. *                                                                             *
  174. * cpl.h -       Control panel extension DLL definitions                       *
  175. *                                                                             *
  176. *               Version 3.10                                                  *
  177. *                                                                             *
  178. *               Copyright (c) 1992-1995, Microsoft Corp.  All rights reserved *
  179. *                                                                             *
  180. ******************************************************************************/
  181. /*
  182. *  General rules for being installed in the Control Panel:
  183. *
  184. *      1) The DLL must export a function named CPlApplet which will handle
  185. *         the messages discussed below.
  186. *      2) If the applet needs to save information in CONTROL.INI minimize
  187. *         clutter by using the application name [MMCPL.appletname].
  188. *      2) If the applet is refrenced in CONTROL.INI under [MMCPL] use
  189. *         the following form:
  190. *              ...
  191. *              [MMCPL]
  192. *              uniqueName=c:\mydir\myapplet.dll
  193. *              ...
  194. *
  195. *
  196. *  The order applet DLL's are loaded by CONTROL.EXE is:
  197. *
  198. *      1) MAIN.CPL is loaded from the windows system directory.
  199. *
  200. *      2) Installable drivers that are loaded and export the
  201. *         CplApplet() routine.
  202. *
  203. *      3) DLL's specified in the [MMCPL] section of CONTROL.INI.
  204. *
  205. *      4) DLL's named *.CPL from windows system directory.
  206. *
  207. */
  208. #ifndef _INC_CPL
  209. #define _INC_CPL
  210.  
  211.  
  212. #include <pshpack1.h>   /* Assume byte packing throughout */
  213.  
  214. #ifdef __cplusplus
  215. extern "C" {            /* Assume C declarations for C++ */
  216. #endif /* __cplusplus */
  217.  
  218. /*
  219.  * CONTROL.EXE will answer this message and launch an applet
  220.  *
  221.  * WM_CPL_LAUNCH
  222.  *
  223.  *      wParam      - window handle of calling app
  224.  *      lParam      - LPTSTR of name of applet to launch
  225.  *
  226.  * WM_CPL_LAUNCHED
  227.  *
  228.  *      wParam      - TRUE/FALSE if applet was launched
  229.  *      lParam      - NULL
  230.  *
  231.  * CONTROL.EXE will post this message to the caller when the applet returns
  232.  * (ie., when wParam is a valid window handle)
  233.  *
  234.  */
  235. #define WM_CPL_LAUNCH   (WM_USER+1000)
  236. #define WM_CPL_LAUNCHED (WM_USER+1001)
  237.  
  238. /* A function prototype for CPlApplet() */
  239.  
  240. //typedef LRESULT (APIENTRY *APPLET_PROC)(HWND hwndCpl, UINT msg, LPARAM lParam1, LPARAM lParam2);
  241. typedef LONG (APIENTRY *APPLET_PROC)(HWND hwndCpl, UINT msg, LONG lParam1, LONG lParam2);
  242.  
  243. /* The data structure CPlApplet() must fill in. */
  244.  
  245. typedef struct tagCPLINFO
  246. {
  247.     int     idIcon;     /* icon resource id, provided by CPlApplet() */
  248.     int     idName;     /* name string res. id, provided by CPlApplet() */
  249.     int     idInfo;     /* info string res. id, provided by CPlApplet() */
  250.     LONG    lData;      /* user defined data */
  251. } CPLINFO, *LPCPLINFO;
  252.  
  253. typedef struct tagNEWCPLINFOA
  254. {
  255.     DWORD   dwSize;         /* similar to the commdlg */
  256.     DWORD   dwFlags;
  257.     DWORD   dwHelpContext;  /* help context to use */
  258.     LONG    lData;          /* user defined data */
  259.     HICON   hIcon;          /* icon to use, this is owned by CONTROL.EXE (may be deleted) */
  260.     CHAR    szName[32];     /* short name */
  261.     CHAR    szInfo[64];     /* long name (status line) */
  262.     CHAR    szHelpFile[128];/* path to help file to use */
  263. } NEWCPLINFOA, *LPNEWCPLINFOA;
  264. typedef struct tagNEWCPLINFOW
  265. {
  266.     DWORD   dwSize;         /* similar to the commdlg */
  267.     DWORD   dwFlags;
  268.     DWORD   dwHelpContext;  /* help context to use */
  269.     LONG    lData;          /* user defined data */
  270.     HICON   hIcon;          /* icon to use, this is owned by CONTROL.EXE (may be deleted) */
  271.     WCHAR   szName[32];     /* short name */
  272.     WCHAR   szInfo[64];     /* long name (status line) */
  273.     WCHAR   szHelpFile[128];/* path to help file to use */
  274. } NEWCPLINFOW, *LPNEWCPLINFOW;
  275. #ifdef UNICODE
  276. typedef NEWCPLINFOW NEWCPLINFO;
  277. typedef LPNEWCPLINFOW LPNEWCPLINFO;
  278. #else
  279. typedef NEWCPLINFOA NEWCPLINFO;
  280. typedef LPNEWCPLINFOA LPNEWCPLINFO;
  281. #endif // UNICODE
  282.  
  283. /* The messages CPlApplet() must handle: */
  284.  
  285. #if(WINVER >= 0x0400)
  286. #define CPL_DYNAMIC_RES 0
  287. // This constant may be used in place of real resource IDs for the idIcon,
  288. // idName or idInfo members of the CPLINFO structure.  Normally, the system
  289. // uses these values to extract copies of the resources and store them in a
  290. // cache.  Once the resource information is in the cache, the system does not
  291. // need to load a CPL unless the user actually tries to use it.
  292. // CPL_DYNAMIC_RES tells the system not to cache the resource, but instead to
  293. // load the CPL every time it needs to display information about an item.  This
  294. // allows a CPL to dynamically decide what information will be displayed, but
  295. // is SIGNIFICANTLY SLOWER than displaying information from a cache.
  296. // Typically, CPL_DYNAMIC_RES is used when a control panel must inspect the
  297. // runtime status of some device in order to provide text or icons to display.
  298.  
  299. #endif /* WINVER >= 0x0400 */
  300.  
  301. #define CPL_INIT        1
  302. /*  This message is sent to indicate CPlApplet() was found. */
  303. /*  lParam1 and lParam2 are not defined. */
  304. /*  Return TRUE or FALSE indicating whether the control panel should proceed. */
  305.  
  306.  
  307. #define CPL_GETCOUNT    2
  308. /*  This message is sent to determine the number of applets to be displayed. */
  309. /*  lParam1 and lParam2 are not defined. */
  310. /*  Return the number of applets you wish to display in the control */
  311. /*  panel window. */
  312.  
  313.  
  314. #define CPL_INQUIRE     3
  315. /*  This message is sent for information about each applet. */
  316. /*  lParam1 is the applet number to register, a value from 0 to */
  317. /*  (CPL_GETCOUNT - 1).  lParam2 is a far ptr to a CPLINFO structure. */
  318. /*  Fill in CPL_INFO's idIcon, idName, idInfo and lData fields with */
  319. /*  the resource id for an icon to display, name and description string ids, */
  320. /*  and a long data item associated with applet #lParam1. */
  321.  
  322.  
  323. #define CPL_SELECT      4
  324. /*  This message is sent when the applet's icon has been clicked upon. */
  325. /*  lParam1 is the applet number which was selected.  lParam2 is the */
  326. /*  applet's lData value. */
  327.  
  328.  
  329. #define CPL_DBLCLK      5
  330. /*  This message is sent when the applet's icon has been double-clicked */
  331. /*  upon.  lParam1 is the applet number which was selected.  lParam2 is the */
  332. /*  applet's lData value. */
  333. /*  This message should initiate the applet's dialog box. */
  334.  
  335.  
  336. #define CPL_STOP        6
  337. /*  This message is sent for each applet when the control panel is exiting. */
  338. /*  lParam1 is the applet number.  lParam2 is the applet's lData  value. */
  339. /*  Do applet specific cleaning up here. */
  340.  
  341.  
  342. #define CPL_EXIT        7
  343. /*  This message is sent just before the control panel calls FreeLibrary. */
  344. /*  lParam1 and lParam2 are not defined. */
  345. /*  Do non-applet specific cleaning up here. */
  346.  
  347.  
  348. #define CPL_NEWINQUIRE    8
  349. /* this is the same as CPL_INQUIRE execpt lParam2 is a pointer to a */
  350. /* NEWCPLINFO structure.  this will be sent before the CPL_INQUIRE */
  351. /* and if it is responed to (return != 0) CPL_INQUIRE will not be sent */
  352.  
  353. #if(WINVER >= 0x0400)
  354. #define CPL_STARTWPARMS 9
  355. /* this message parallels CPL_DBLCLK in that the applet should initiate
  356. ** its dialog box.  where it differs is that this invocation is coming
  357. ** out of RUNDLL, and there may be some extra directions for execution.
  358. ** lParam1: the applet number.
  359. ** lParam2: an LPSTR to any extra directions that might exist.
  360. ** returns: TRUE if the message was handled; FALSE if not.
  361. */
  362. #endif /* WINVER >= 0x0400 */
  363.  
  364.  
  365. /* This message is internal to the Control Panel and MAIN applets.  */
  366. /* It is only sent when an applet is invoked from the Command line  */
  367. /* during system installation.                                      */
  368. #define CPL_SETUP               200 
  369.  
  370. #ifdef __cplusplus
  371. }
  372. #endif    /* __cplusplus */
  373.  
  374. #include <poppack.h>
  375.  
  376. #endif  /* _INC_CPL */
  377.  
  378.  
  379. #endif /* !__FLAT__ */
  380.